- Use positional argument specifiers in
str.format()
- Name the method starting with a verb
- Specify required arguments as positional arguments
- Specify optional arguments as keyword arguments
- Include
**kwargs
as the last parameter - Use the newest supported implementation (e.g. v4 instead of v1, even if a related API only has a v1 implementation)
Document all notable changes in CHANGELOG.md per principles and guidelines at Keep a Changelog.
We use the pytest test framework.
To run all tests, run this at the root of the repo:
python setup.py test
Put actual before expected values in assert statements. Pytest assumes this order.
a = 4
assert a % 2 == 0
Use failure messages in assertions
assert a % 2 == 0, "value was odd, should be even"
Use the following naming convention with test methods:
test_[unit_under_test]_[variables_for_the_test]_[expected_state]
Example:
def test_add_one_and_one_equals_two():