GeezerVison is showing github.com — gh-109546: Add more tests for formatting floats and fractions by serhiy-storchaka · Pull Request #109548 · python/cpython
Conversation
serhiy-storchaka
commented
Sep 18, 2023
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to not load test_float in test_fractions just to get a filename.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
|
|
|
@requires_IEEE_754
|
|
|
def test_float_format_testfile(self):
|
|
|
from test.test_float import format_testfile
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer to just copy/paste the code to get the path here:
format_testfile = os.path.join(test_dir, 'formatfloat_testcases.txt')
I prefer to not make tests inter-dependents. Sometimes, just importing a test has side effects.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
mdickinson and AlexWaygood reacted with thumbs up emoji
|
|
continue
|
|
|
line = line.strip()
|
|
|
if not line:
|
|
|
continue
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that such logic is used in other files using formatfloat_testcases.txt. Is there a good place to share common code?
If we add mathdata/, can we add a helper function there which would iterate on the file and strip comments?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was going to add it in test_float, but it is simple enough, so I just copied it.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
if fmt == '%r':
|
|
|
continue
|
|
|
with self.subTest(fmt=fmt, arg=arg):
|
|
|
f = F(float(arg))
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add a variable for fmt[1:].
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
+1 for the idea, and code changes LGTM.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 RHEL8 3.x has failed when building commit beb5ec5.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/185/builds/5034) and take a look at the build logs.
- Check if the failure is related to this commit (beb5ec5) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/185/builds/5034
Failed tests:
- test.test_multiprocessing_fork.test_misc
Failed subtests:
- test_nested_startmethod - test.test_multiprocessing_fork.test_misc.TestStartMethod.test_nested_startmethod
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-x86_64/build/Lib/test/_test_multiprocessing.py", line 5475, in test_nested_startmethod
self.assertEqual(results, [2, 1])
AssertionError: Lists differ: [1, 2] != [2, 1]
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot AMD64 RHEL8 FIPS Only Blake2 Builtin Hash 3.x has failed when building commit beb5ec5.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/469/builds/6024) and take a look at the build logs.
- Check if the failure is related to this commit (beb5ec5) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/469/builds/6024
Failed tests:
- test.test_asyncio.test_subprocess
Failed subtests:
- test_subprocess_consistent_callbacks - test.test_asyncio.test_subprocess.SubprocessThreadedWatcherTests.test_subprocess_consistent_callbacks
Summary of the results of the build (if available):
==
Click to see traceback logs
Traceback (most recent call last):
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_asyncio/test_subprocess.py", line 788, in test_subprocess_consistent_callbacks
self.loop.run_until_complete(main())
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/asyncio/base_events.py", line 664, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "/home/buildbot/buildarea/3.x.cstratak-RHEL8-fips-x86_64.no-builtin-hashes-except-blake2/build/Lib/test/test_asyncio/test_subprocess.py", line 780, in main
self.assertEqual(events, [
AssertionError: Lists differ: [('pi[29 chars]t'), 'pipe_connection_lost', ('pipe_data_recei[57 chars]ted'] != [('pi[29 chars]t'), ('pipe_data_received', 2, b'stderr'), 'pi[57 chars]ted']
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
⚠️⚠️⚠️ Buildbot failure ⚠️⚠️⚠️
Hi! The buildbot PPC64LE RHEL7 LTO + PGO 3.x has failed when building commit beb5ec5.
What do you need to do:
- Don't panic.
- Check the buildbot page in the devguide if you don't know what the buildbots are or how they work.
- Go to the page of the buildbot that failed (https://buildbot.python.org/all/#builders/43/builds/4246) and take a look at the build logs.
- Check if the failure is related to this commit (beb5ec5) or if it is a false positive.
- If the failure is related to this commit, please, reflect that on the issue and make a new Pull Request with a fix.
You can take a look at the buildbot page here:
https://buildbot.python.org/all/#builders/43/builds/4246
Failed tests:
- test.test_multiprocessing_fork.test_processes
Summary of the results of the build (if available):
==
Click to see traceback logs
remote: Enumerating objects: 6, done.
remote: Counting objects: 16% (1/6)
remote: Counting objects: 33% (2/6)
remote: Counting objects: 50% (3/6)
remote: Counting objects: 66% (4/6)
remote: Counting objects: 83% (5/6)
remote: Counting objects: 100% (6/6)
remote: Counting objects: 100% (6/6), done.
remote: Compressing objects: 16% (1/6)
remote: Compressing objects: 33% (2/6)
remote: Compressing objects: 50% (3/6)
remote: Compressing objects: 66% (4/6)
remote: Compressing objects: 83% (5/6)
remote: Compressing objects: 100% (6/6)
remote: Compressing objects: 100% (6/6), done.
remote: Total 6 (delta 0), reused 0 (delta 0), pack-reused 0
From https://github.com/python/cpython
* branch main -> FETCH_HEAD
Note: checking out 'beb5ec5817b645562ebbdd59f25683a93061c32c'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
HEAD is now at beb5ec5... gh-109546: Add more tests for formatting floats and fractions (GH-109548)
Switched to and reset branch 'main'
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
find: ‘build’: No such file or directory
make[2]: [Makefile:2807: clean-retain-profile] Error 1 (ignored)
./Modules/_testcapi/unicode.c: In function ‘test_string_from_format’:
./Modules/_testcapi/unicode.c:1538:1: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
test_string_from_format(PyObject *self, PyObject *Py_UNUSED(ignored))
^~~~~~~~~~~~~~~~~~~~~~~
./Modules/_testcapi/unicode.c: In function ‘test_string_from_format’:
./Modules/_testcapi/unicode.c:1538:1: note: variable tracking size limit exceeded with -fvar-tracking-assignments, retrying without
test_string_from_format(PyObject *self, PyObject *Py_UNUSED(ignored))
^
./Modules/_decimal/libmpdec/context.c:57: warning: mpd_setminalloc: ignoring request to set MPD_MINALLOC a second time
./Modules/_decimal/libmpdec/context.c:57: warning: mpd_setminalloc: ignoring request to set MPD_MINALLOC a second time
make: *** [Makefile:2027: buildbottest] Error 5
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sorry, @serhiy-storchaka, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker beb5ec5817b645562ebbdd59f25683a93061c32c 3.11
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Oh. I tried to backport this change to 3.11 to prepare backporting PR #109512 to 3.11 and 3.12, but the fractions module doesn't support all formatting syntax in 3.11:
ERROR: test_float_format_testfile (test.test_fractions.FractionTest.test_float_format_testfile) (fmt='%.1g', arg='10')
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/vstinner/python/3.11/Lib/test/test_fractions.py", line 856, in test_float_format_testfile
self.assertEqual(format(f, fmt2), rhs)
^^^^^^^^^^^^^^^
TypeError: unsupported format string passed to Fraction.__format__
So this change cannot be backported.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I partially backported the change to 3.11: only test_float changes.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
Development
Successfully merging this pull request may close these issues.
Uh oh!
There was an error while loading. Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
|