GeezerVison is showing github.com — gh-108303: Move all math files to `Lib/test/mathdata/` by sobolevn · Pull Request #109512 · python/cpython
Conversation
sobolevn
commented
Sep 17, 2023
•
edited by bedevere-app
Bot
Loading
Uh oh!
There was an error while loading. Please reload this page.
This one is pretty straight-forward. All math data now lives in a specialized place.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This comment was marked as spam.
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 dislike "data" directories.
It seems like test_math uses 3 data files which are only used by test_math.
test_float uses 2 data files which are only used by test_float.
For me, "data" directories are nice when data files are shared by different tests. It doesn't seem to be the case here.
What do you think of creating test_float/ and test_math/ directories instead?
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
What do you think of creating test_float/ and test_math/ directories instead?
I don't have any strong opinions here, for me mathdata/ seems like a more simple way of organizing tests. But, I can change it to be test_math/ (with possibly test_cmath.py inside) and test_float/
Why do I prefer the first option? Because later some other file can be added there: possibly from test_int.py or test_decimal.py or whatever. Or some test from test_math.py can reuse float test data. This is why I went with the approach in this PR.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
"cmath_testcases.txt" is shared with test_cmath.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
"cmath_testcases.txt" is shared with test_cmath.
test_cmath uses dark black magic, it uses class inheritance:
class IsCloseTests(test_math.IsCloseTests):
So it doesn't directly reuses "cmath_testcases.txt", but uses it "via" test_math. Oh, that's "surprising".
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@serhiy-storchaka approved the change, I'm not strongly against Lib/test/mathdata/ approach.
I'm just surprised that 2 test files are added there whereas they are only used by test_float. I don't see the point of "sharing" these two files. Maybe make a test_float/ directory for them?
@serhiy-storchaka: If you're fine with mathdata/ approach,go ahead and merge the PR :-)
Because later some other file can be added there: possibly from test_int.py or test_decimal.py or whatever. Or some test from test_math.py can reuse float test data.
That sounds to be be an hypothetical use case. I would prefer to stick to current test data files usage to decide how to organize them.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
It also imports the path to the test data file and the parsing function from test_math, and runs tests without skipping complex numbers.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
I can see the point of having mathdata/ for test_math and test_cmath.
What about test_float test files?
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
I'm just surprised that 2 test files are added there whereas they are only used by test_float. I don't see the point of "sharing" these two files. Maybe make a test_float/ directory for them?
They could be used in tests for decimal and fractions. I am not even sure that they are not yet used there.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
They could be used in tests for decimal and fractions.
If tomorrow other tests start using test_float data files, we can re-consider the organization of these data files, no? Are you proposing to make this change right now?
I am not even sure that they are not yet used there.
You can easily test: remove data files, run tests, do they still pass? :-)
The purpose of #108303 is to clarify how test data files are used ;-)
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
To me, these kind of edits (mostly rearrangements) have no value. It is mostly just churn.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
If tomorrow other tests start using test_float data files, we can re-consider the organization of these data files, no?
#109548
|
sobolevn reacted with thumbs up emoji
AlexWaygood reacted with laugh emoji
All reactions
-
👍
1 reaction
-
😄
1 reaction
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.
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.
|
Thanks @sobolevn for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks @sobolevn for the PR, and @vstinner for merging it 🌮🎉.. 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, @sobolevn and @vstinner, I could not cleanly backport this to 3.11 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker ed587be0d0383f2925bf7650e8ccf1bf3adc44f9 3.11
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Sorry, @sobolevn and @vstinner, I could not cleanly backport this to 3.12 due to a conflict.
Please backport using cherry_picker on command line.
cherry_picker ed587be0d0383f2925bf7650e8ccf1bf3adc44f9 3.12
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Oh, this PR was outdated since PR #109548 got merged! I wrote PR #109686 to fix it.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Reviewers
vstinner
vstinner approved these changes
+1 more reviewer
Reviewers whose approvals may not affect merge requirements
Uh oh!
There was an error while loading. Please reload this page.
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.
|