[Python-Dev] Using more specific methods in Python unit tests
storchaka at gmail.com
Sat Feb 15 19:12:33 CET 2014
Many Python tests were written a very long time before the unittest,
using simple asserts. Then, when they have been ported to the unittest,
asserts were replaced with the assert_ method and then with assertTrue.
The unittest has a number of other methods to check for and report
failure, from assertEqual, to more specific assertIs, assertIn,
assertIsInstance, etc, added in 2.7. New methods provide better
reporting in case of failure.
I wrote a large patch which modifies the tests to use more specific
methods . Because it is too large, it was divided into many smaller
patches, and separate issues were opened for them. At the moment the
major part of the original patch has already been committed. Many thanks
to Ezio for making a review for the majority of the issues. Some changes
have been made by other people in unrelated issues.
Although Raymond approved a patch for test_bigmem , his expressed the
insistent recommendation not to do this. So I stop committing new
reviewed patches. Terry recommended to discuss this in Python-Dev. What
are your thoughts?
More information about the Python-Dev