Issue 11754: Check calculated constants in test_string.py (original) (raw)

Issue11754

Created on 2011-04-03 19:52 by Lynne.Qu, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test_calculated_constants.diff Lynne.Qu,2011-04-03 19:52
test_calculated_constants.diff JoelLuellwitz,2011-04-03 20:32
issue11754_patch.txt chalmerlowe,2015-04-13 20:29 hg diff of test_string.py review
issue11754_patch_2.txt chalmerlowe,2015-04-13 23:13 Revised patch file... review
Messages (11)
msg132874 - (view) Author: Lynne Qu (Lynne.Qu) Date: 2011-04-03 19:52
Changed test to check calculated constants in test_string.py
msg132879 - (view) Author: Joel Luellwitz (JoelLuellwitz) Date: 2011-04-03 20:32
Make a slight change to diff file.
msg132981 - (view) Author: Benjamin Peterson (benjamin.peterson) * (Python committer) Date: 2011-04-04 22:12
Being rather circular, that doesn't seem to be a particularly useful test. (Not that the original is either.) It'd be more "correct" if you actually tested that hex numbers are contained within string.hexdigits, for example.
msg133347 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-04-08 22:36
I do not understand 'circular'. The change is from 'attribute exists' to 'attribute has correct value'. If any are changed, I would think all should be changed.
msg221738 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-27 21:27
I see very little value in implementing this change, thoughts?
msg221766 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2014-06-28 02:02
Three years later, I do understand 'circular'. Such cut-and-paste whitebox tests tend to simultaneously test too much -- the particular implementation(1) -- and too little -- the actual specification(2). (1) The test would falsely fail if a string were reordered but still correct. (2) The test would falsely pass is any of the existing strings were incorrect. Most of the strings have a specification other than the existing string and all can be tested in an order free manner. Hexdigits example: import string assert len(set(string.hexdigits)) == 22 for c in string.hexdigits: assert '0' <= c <= '9' or 'a' <= c <= 'f' or 'A' <= c <= 'F' I would be willing to push such a patch. I would also be willing to close this now.
msg240734 - (view) Author: chalmer_lowe (chalmerlowe) * Date: 2015-04-13 20:29
Discussed with David Murray at PyCon Sprints 2015. Considered the fact that to preserve backwards compatibility, it seems important that rather than a) merely checking for the presence of each constant string (as the test does now) OR b) checking for each desired character (regardless of order) as noted in the tests should check for the exact strings that have historically been published in Python. Doing so seems to be the right path to ensure that: a) the strings exist AND b) the strings have not inadvertently changed.
msg240751 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-13 21:06
Added a review comment.
msg240803 - (view) Author: chalmer_lowe (chalmerlowe) * Date: 2015-04-13 23:13
Based on review comments, in order to reduce unnecessary redundancy in the tests: - composed later strings from previously defined substrings, where it made sense to do so.
msg240812 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2015-04-14 00:08
New changeset e1457e9f340f by R David Murray in branch 'default': #11754: test contents of string module attributes. https://hg.python.org/cpython/rev/e1457e9f340f
msg240813 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-14 00:11
Thanks, Chalmer. Hopefully Benjamin won't be too annoyed by these :)
History
Date User Action Args
2022-04-11 14:57:15 admin set github: 55963
2015-04-14 00:11:17 r.david.murray set status: open -> closedversions: - Python 2.7, Python 3.4messages: + resolution: fixedstage: needs patch -> resolved
2015-04-14 00:08:44 python-dev set nosy: + python-devmessages: +
2015-04-13 23:13:49 chalmerlowe set files: + issue11754_patch_2.txtmessages: +
2015-04-13 21:06:10 r.david.murray set nosy: + r.david.murraymessages: +
2015-04-13 20:29:09 chalmerlowe set files: + issue11754_patch.txtnosy: + chalmerlowemessages: +
2014-06-28 03:40:05 terry.reedy set title: Changed test to check calculated constants in test_string.py -> Check calculated constants in test_string.py
2014-06-28 02:02:51 terry.reedy set keywords: + easytype: behavior -> enhancementmessages: + stage: needs patch
2014-06-27 21:27:41 BreamoreBoy set nosy: + BreamoreBoymessages: + versions: + Python 2.7, Python 3.4, Python 3.5, - Python 3.3
2011-04-08 22:36:16 terry.reedy set nosy: + terry.reedymessages: +
2011-04-04 22:12:14 benjamin.peterson set nosy: + benjamin.petersonmessages: +
2011-04-04 16:12:23 brian.curtin set nosy: + brian.curtin
2011-04-03 20:32:23 JoelLuellwitz set files: + test_calculated_constants.diffnosy: + JoelLuellwitzmessages: +
2011-04-03 19:52:26 Lynne.Qu create