Skip to content

Latest commit

 

History

History
61 lines (37 loc) · 1.19 KB

CONTRIBUTING.md

File metadata and controls

61 lines (37 loc) · 1.19 KB

Contributing to the Code42 Python SDK

General

Do

  • Use positional argument specifiers in str.format()

Wrapping web APIs

Do

  • 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)

Changes

Do

Document all notable changes in CHANGELOG.md per principles and guidelines at Keep a Changelog.

Tests

We use the pytest test framework.

To run all tests, run this at the root of the repo:

python setup.py test

Writing tests

Do

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():