Normalizes method names according to PEP8.
Project description
Namalizer — smart method name normalizer
========================================
It allows you to keep PEP8 naming style, using libraries like `Twisted` or `unittest`.
Here is example:
#!/usr/bin/python
import unittest
from namalizer import pep8
class MyTests(unittest.TestCase):
def set_up(self):
self.a = 'blah'
def test_example(self):
self.assert_equal(self.a, 'blah')
pep8(**locals())
# or
pep8(MyTests)
if __name__ == '__main__':
unittest.main()
Namalizer creates aliases for method with wrong names. In this case,
it will create aliazes in `unittest.TestCase` for methods like `setUp`,
`assertEqual`, etc..
Then, it will see that you created method `set_up` to override base class's
functionality and will create alias `setUp` for this method, this way
when `unittest` will call `setUp`, you version will be called.
Migration
---------
If you use some library with ugly naming method, this regex will help you to
find all places where wrong names are used:
git grep -e '\(\.\|def \)[a-z]\+[A-Z]'
Credits
-------
* Alexander Artemenko <<svetlyak.40wt@gmail.com>> — original author.
Fork the project, contribute and send me patches.
========================================
It allows you to keep PEP8 naming style, using libraries like `Twisted` or `unittest`.
Here is example:
#!/usr/bin/python
import unittest
from namalizer import pep8
class MyTests(unittest.TestCase):
def set_up(self):
self.a = 'blah'
def test_example(self):
self.assert_equal(self.a, 'blah')
pep8(**locals())
# or
pep8(MyTests)
if __name__ == '__main__':
unittest.main()
Namalizer creates aliases for method with wrong names. In this case,
it will create aliazes in `unittest.TestCase` for methods like `setUp`,
`assertEqual`, etc..
Then, it will see that you created method `set_up` to override base class's
functionality and will create alias `setUp` for this method, this way
when `unittest` will call `setUp`, you version will be called.
Migration
---------
If you use some library with ugly naming method, this regex will help you to
find all places where wrong names are used:
git grep -e '\(\.\|def \)[a-z]\+[A-Z]'
Credits
-------
* Alexander Artemenko <<svetlyak.40wt@gmail.com>> — original author.
Fork the project, contribute and send me patches.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
namalizer-0.1.1.tar.gz
(2.6 kB
view details)
File details
Details for the file namalizer-0.1.1.tar.gz
.
File metadata
- Download URL: namalizer-0.1.1.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 409ecc0476e992b1c2c493207daa98e2ebee8476c214c5a40d5e0edad01608d4 |
|
MD5 | 4d65a18d335428f1548503b21f4b41a3 |
|
BLAKE2b-256 | 8fd61c0bec28dfd226b7f4dae4d268b2ef27d5a75e558abd42ca8096d7b9067e |