homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Unify tests for str.format and string.Formatter
Type: enhancement Stage: patch review
Components: Tests Versions: Python 3.10
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: eric.araujo, eric.smith, ezio.melotti, francisco.freire, francismb, moijes12, nanjekyejoannah, ncoghlan, terry.reedy, vstinner
Priority: normal Keywords: patch

Created on 2012年02月15日 08:15 by ncoghlan, last changed 2022年04月11日 14:57 by admin.

Messages (19)
msg153392 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2012年02月15日 08:15
A couple of issues have arisen where features were added to str.format without similarly being added to string.Formatter.
This is only possible because the test cases for the two are currently almost entirely separate.
A common set of tests defined as (fmt, args, kwargs, output) tuples would help ensure that the implementations remained consistent in the future.
msg153729 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2012年02月19日 22:39
(ISTM that such test improvements would be beneficial to all branches, and we would also eschew merge issues if we change all branches. Other core devs sometimes object to test improvements or additions in stable branches though.)
msg154000 - (view) Author: Francis MB (francismb) * Date: 2012年02月22日 22:11
I have some questions about this:
1) In Lib/test/string_tests.py it says:
"Common tests shared by test_str, test_unicode, test_userstring and
test_string"
but
 a) I cannot find test_str
 b) string is imported and only some constants ascii_letters
 and digits are used
 c) In test_join there is a comment "see the test in
 test.test_string.StringTest.test_join" Is that obsolete?
 (I cannot find StringTest in the test_string test)
2) Is there more tests for the build in format (in
test_buildin.BuiltinTest.test_format only the basic machinery is tested.
I would expect something like in test_format.py somewhere
3) it is true that all tests for the build in 'format' should also pass 
in 'string.Formatter().format'
Thanks in advance!
francis
msg154002 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2012年02月22日 22:18
At least the first couple of those look like obsolete comments left over from the 2.x branch (we didn't do a mass renaming in the test suite, so many tests still live in their old locations).
msg194709 - (view) Author: Francisco Freire (francisco.freire) * Date: 2013年08月08日 22:15
I increased the coverage of formatter module to 40%. I added a new file "test_formatter.py" including some unit tests.
msg195061 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013年08月13日 09:50
I left a review on rietveld.
FWIW I think string_tests and related files should undergo a (major?) refactoring. I worked with them a few times and it's a bit of a mess with all those base classes and mixins. I also found some tests that weren't running because they were accidentally overridden by one of the subclasses, or other tests that were duplicated. This is especially true on Python 3, where bytes and str share a smaller subset of features.
msg196074 - (view) Author: Francisco Freire (francisco.freire) * Date: 2013年08月24日 11:50
Thanks for the review. I corrected some issues in my code. Here is the new patch.
msg217757 - (view) Author: Francis MB (francismb) * Date: 2014年05月02日 16:42
The formatter module was deprecated in Python 3.4 and is scheduled
for removal in Python 3.6. See [1] and [2].
---
[1] https://docs.python.org/3/library/formatter.html#module-formatter
[2] https://docs.python.org/3/whatsnew/3.4.html#deprecated 
msg217904 - (view) Author: Alyssa Coghlan (ncoghlan) * (Python committer) Date: 2014年05月05日 03:54
Note that this issue wasn't about the formatter module - it relates to the str.format() method and the string.Formatter *class*.
The formatter module is completely unrelated.
msg217927 - (view) Author: Eric V. Smith (eric.smith) * (Python committer) Date: 2014年05月05日 15:10
The issue is about tests for str.format and string.Formatter, but in http://bugs.python.org/msg194709 and the associated patch there are tests for the formatter module to increase its coverage.
I suggested on the mentorship list that we break this into two issues.
msg218159 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014年05月09日 12:35
Francisco, can you sign the contributor agreement? https://www.python.org/psf/contrib/contrib-form/ 
msg218163 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014年05月09日 13:49
I added some review comments.
msg218976 - (view) Author: Brett Cannon (brett.cannon) * (Python committer) Date: 2014年05月23日 15:43
Set to "pending" while I wait to hear back from Francisco on the review comments.
msg219011 - (view) Author: Francisco Freire (francisco.freire) * Date: 2014年05月23日 23:11
Hi, I signed the contributor agreement. Thank you for your review comments. I did these tests about one year ago and right now I don't have much time to look at it again. I hope to do so in the next months.
msg219508 - (view) Author: moijes12 (moijes12) Date: 2014年06月01日 16:14
> Note that this issue wasn't about the formatter module - it relates to the str.format() method and the string.Formatter *class*.
I would tend to agree with Nick and Eric. From what I see in the patch, the tests are for formatter module and not the string.Formatter class.
msg348636 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2019年07月29日 11:47
This issue is no newcomer friendly, I remove the "easy" keyword.
msg380590 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020年11月09日 14:51
@Irit Katriel: Please avoid changing the versions field of old inactive issues. It changes artificially the last activity date of an issue and it sends an email to all people in the nosy list. There is no need to update the Version field of the +7500 open bugs.
msg380625 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2020年11月10日 00:23
Victor: Irit is reviewing old issues to decide whether to close or not. She has to touch it somehow to mark it as reviewed.
Irit: if you only change the version, others may think that you blindly updated the version. Better to say something that moves the issue forward. Also, only marking for the next version, now 3.10, would delay the possible future obsolescence of the version marking. In any case, any coredev who merges would decide about backports.
This particular issue needs major surgery as it is two interleaved but unrelated discussions. Francisco should have moved his unrelated patch to a new issue as Eric Smith asked. I opened new issue 42299 and moved the revised patch there, with credit to Francisco and Ezio as reviewer. I unlinked both from here.
To make the discussion of Nick's issue more readable, the unrelated messages about the unrelated patch should be unlinked. I believe each message unlink would generate a separate email, as did the file unlinks.
msg380665 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020年11月10日 13:53
Since nobody implemented this idea in 8 years, maybe it's time to give up and close this issue as out of date. It seeems like Nick was busy with other stuff, and nobody took this task in the meanwhile.
History
Date User Action Args
2022年04月11日 14:57:26adminsetgithub: 58227
2020年11月10日 13:53:04vstinnersetmessages: + msg380665
2020年11月10日 00:23:10terry.reedysetmessages: + msg380625
versions: - Python 3.8, Python 3.9
2020年11月10日 00:13:58terry.reedysetfiles: - mywork2.patch
2020年11月09日 23:42:36terry.reedysetfiles: - mywork.patch
2020年11月09日 14:51:43vstinnersetmessages: + msg380590
2020年11月06日 23:00:06iritkatrielsetversions: + Python 3.8, Python 3.9, Python 3.10, - Python 2.6, Python 3.3, Python 3.4
2020年01月29日 03:22:02josephgordonsetnosy: - josephgordon
2020年01月29日 00:57:17brett.cannonsetnosy: - brett.cannon
2019年08月07日 12:52:57nanjekyejoannahsetnosy: + nanjekyejoannah
2019年07月29日 11:47:28vstinnersetkeywords: - easy
nosy: + vstinner
messages: + msg348636

2015年12月14日 02:25:23josephgordonsetnosy: + josephgordon
2015年04月24日 15:56:59brett.cannonsetassignee: brett.cannon ->
2014年06月01日 16:14:16moijes12setnosy: + moijes12
messages: + msg219508
2014年05月23日 23:11:30francisco.freiresetstatus: pending -> open

messages: + msg219011
2014年05月23日 15:43:55brett.cannonsetstatus: open -> pending

messages: + msg218976
2014年05月09日 13:49:40brett.cannonsetmessages: + msg218163
2014年05月09日 12:35:12brett.cannonsetmessages: + msg218159
2014年05月05日 15:10:16eric.smithsetmessages: + msg217927
2014年05月05日 03:54:23ncoghlansetmessages: + msg217904
2014年05月03日 13:43:14brett.cannonsetassignee: brett.cannon

nosy: + brett.cannon
2014年05月02日 16:42:24francismbsetmessages: + msg217757
2013年08月24日 11:50:30francisco.freiresetfiles: + mywork2.patch

messages: + msg196074
2013年08月13日 09:50:43ezio.melottisetversions: + Python 3.4, - Python 3.2
nosy: + ezio.melotti

messages: + msg195061

type: enhancement
stage: patch review
2013年08月08日 22:15:21francisco.freiresetfiles: + mywork.patch

nosy: + francisco.freire
messages: + msg194709

keywords: + patch
2012年02月22日 22:18:49ncoghlansetmessages: + msg154002
2012年02月22日 22:11:08francismbsetmessages: + msg154000
2012年02月19日 22:39:03eric.araujosetversions: + Python 2.6, Python 3.2
nosy: + eric.araujo

messages: + msg153729

keywords: + easy
2012年02月15日 20:46:31terry.reedysetnosy: + terry.reedy
2012年02月15日 17:38:12francismbsetnosy: + francismb
2012年02月15日 11:24:41eric.smithsetnosy: + eric.smith
2012年02月15日 08:15:04ncoghlancreate

AltStyle によって変換されたページ (->オリジナル) /