Test formatting standard

Ian Bruene ianbruene at gmail.com
Thu May 18 01:34:36 UTC 2017


Currently the tests follow a general format of a comment line describing 
what a particular test is attempting to test, followed by the test. I 
propose that the first line of each test_* function be the assignment of 
a shorter name for the function being tested. For examples see a number 
of the tests in test_util.py.

Reasoning:
It greatly reduces the number of unnecessary characters typed.
It eliminates the potential of typos in the function name when making 
new tests, which due to the sheer length are more annoying to track down 
than they should be.
It is added semantic information; clearly establishing the correct 
function in a similar way to a docstring.
The cost of doing it this way is negligible: one very simple line of 
source, and one assignment.

I've already been doing this with the tests I write, and it looks 
cleaner than the alternative. Again, see test_util.py for examples.

-- 
In the end; what separates a Man, from a Slave? Money? Power?
No. A Man Chooses, a Slave Obeys. -- Andrew Ryan



More information about the devel mailing list