the tests from lines 15--57 only differ in their input, not in their assertions. pytest offers a feature for parametrizing test functions: http://pytest.org/latest/parametrize.html#pytest-mark-parametrize-parametrizing-test-functions. Use it so that only one test function is required which receives the different time inputs.