[issue11505] string.py increased test coverage

Nick Coghlan report at bugs.python.org
Tue May 31 11:54:34 CEST 2011


Nick Coghlan <ncoghlan at gmail.com> added the comment:

Some comments on the follow-up changes I just committed:

- It's an illustration of the fact that coverage data is only step 1 in improving tests.

- I added additional assertions regarding the error message contents to a couple of tests, and also verified that the formatting code correctly allowed AttributeError, KeyError and IndexError to escape to the calling code when using subfield lookup.

- I changed the names of several of the test methods to more accurately reflect what they were designed to test.

- I broke up the original string formatting tests into multiple test methods. This fit in better with the updated method names and helps with diagnosing any errors that do arise in the future, since the smaller test methods help localise any failures.

- complex white-box tests designed to exercise obscure error paths definitely benefit from comments explaining what they're trying to do, which is definitely the case for the new test in test_pep292 which required an appropriately crafted template pattern

- I adjusted some of the new test methods to follow the same naming conventions as similar tests that were already in the test cases

Still, thanks to Alicia for the original patch and Jerome for picking up on the error in the vformat recursion limit test. Even if the final code doesn't look much like the initial patch, the latest version of these changes likely wouldn't have happened without those contributions.

----------
resolution: fixed -> 
stage: committed/rejected -> commit review
status: closed -> open

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue11505>
_______________________________________


More information about the Python-bugs-list mailing list