Uh oh!
There was an error while loading. Please reload this page.
gh-109546: Add more tests for formatting floats and fractions - #109548
Conversation
vstinner
left a comment
There was a problem hiding this comment.
I would prefer to not load test_float in test_fractions just to get a filename.
| @requires_IEEE_754 | ||
| def test_float_format_testfile(self): | ||
| from test.test_float import format_testfile |
There was a problem hiding this comment.
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.
| continue | ||
| line = line.strip() | ||
| if not line: | ||
| continue |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
I was going to add it in test_float, but it is simple enough, so I just copied it.
| if fmt == '%r': | ||
| continue | ||
| with self.subTest(fmt=fmt, arg=arg): | ||
| f = F(float(arg)) |
18c9aab to
22245e4Comparemdickinson
commented
Sep 18, 2023
+1 for the idea, and code changes LGTM. |
miss-islington
commented
Sep 19, 2023
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.12. |
…ythonGH-109548) (cherry picked from commit beb5ec5) Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
GH-109557 is a backport of this pull request to the 3.12 branch. |
bedevere-bot
commented
Sep 19, 2023
|
bedevere-bot
commented
Sep 19, 2023
|
bedevere-bot
commented
Sep 19, 2023
|
miss-islington
commented
Sep 21, 2023
Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.11. |
miss-islington
commented
Sep 21, 2023
Sorry, @serhiy-storchaka, I could not cleanly backport this to |
vstinner
commented
Sep 21, 2023
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: So this change cannot be backported. |
(cherry picked from commit beb5ec5)
GH-109685 is a backport of this pull request to the 3.11 branch. |
vstinner
commented
Sep 21, 2023
I partially backported the change to 3.11: only test_float changes. |
Uh oh!
There was an error while loading. Please reload this page.