Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
nose/case.{Function,Method}TestCase: have consistent __repr__
Tests were added in the previous commit which showed that modifying a mutable object given as an argument to a test case during the execution of the test case results in the __repr__ of the test case also changing (if the __repr__ of the object also changed). This was caused by creating a __repr__ of the test args on the fly, and because the summary line is printed *before* the test is executed and failure details are printed *after* the test is executed, this can result in the two lines having different __repr__s of the passed in arguments (see the previous commit message for an example of the output). This commit fixes the issue by storing a __repr__ of the argument tuple when the *TestCase is instantiated and using that to create all __repr__s of the *TestCase. Note that the `if` for when no args are given had to be changed because `repr(tuple())` is '()', which is truthy.
- Loading branch information