GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — gh-108303: Move all math files to `Lib/test/mathdata/` by sobolevn · Pull Request #109512 · python/cpython

Conversation

@sobolevn

@sobolevn sobolevn commented Sep 17, 2023 •
edited by bedevere-app Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

This one is pretty straight-forward. All math data now lives in a specialized place.

  • Issue: Move test files into test subdirectories #108303

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@sobolevn
pythongh-108303: Move all math files to Lib/test/mathdata/
b7916fa
@sobolevn
sobolevn requested a review from vstinner September 17, 2023 09:58
@bedevere-app bedevere-app Bot added the awaiting review label Sep 17, 2023
@bedevere-app bedevere-app Bot mentioned this pull request Sep 17, 2023
Move test files into test subdirectories #108303
Closed
@sobolevn sobolevn added the skip news label Sep 17, 2023
lizzydavis695

This comment was marked as spam.

Sign in to view

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bedevere-app bedevere-app Bot added awaiting core review and removed awaiting review labels Sep 17, 2023
serhiy-storchaka
serhiy-storchaka approved these changes Sep 18, 2023
View reviewed changes
vstinner
vstinner reviewed Sep 18, 2023
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

All reactions
@sobolevn

sobolevn commented Sep 18, 2023

Copy link
Copy Markdown
Member Author

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Sep 18, 2023

Copy link
Copy Markdown
Member

"cmath_testcases.txt" is shared with test_cmath.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 18, 2023

Copy link
Copy Markdown
Member

"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".

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 18, 2023

Copy link
Copy Markdown
Member

@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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Sep 18, 2023

Copy link
Copy Markdown
Member

It also imports the path to the test data file and the parsing function from test_math, and runs tests without skipping complex numbers.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 18, 2023

Copy link
Copy Markdown
Member

I can see the point of having mathdata/ for test_math and test_cmath.

What about test_float test files?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Sep 18, 2023

Copy link
Copy Markdown
Member

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner

vstinner commented Sep 18, 2023

Copy link
Copy Markdown
Member

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 ;-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@rhettinger

rhettinger commented Sep 18, 2023

Copy link
Copy Markdown
Contributor

To me, these kind of edits (mostly rearrangements) have no value. It is mostly just churn.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@serhiy-storchaka

serhiy-storchaka commented Sep 18, 2023

Copy link
Copy Markdown
Member

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.

@vstinner

vstinner commented Sep 19, 2023

Copy link
Copy Markdown
Member

Oh, @serhiy-storchaka made #109548 which makes mathdata/ directory more relevant :-)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@vstinner vstinner mentioned this pull request Sep 21, 2023
gh-109546: Add more tests for formatting floats and fractions #109548
Merged
vstinner
vstinner approved these changes Sep 21, 2023
View reviewed changes

@vstinner vstinner left a comment

Copy link
Copy Markdown
Member

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.

LGTM.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@vstinner
vstinner merged commit ed587be into python:main Sep 21, 2023
@bedevere-app bedevere-app Bot removed the awaiting core review label Sep 21, 2023
@vstinner vstinner added needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Sep 21, 2023
@miss-islington

miss-islington commented Sep 21, 2023

Copy link
Copy Markdown
Contributor

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!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington

miss-islington commented Sep 21, 2023

Copy link
Copy Markdown
Contributor

Thanks @sobolevn for the PR, and @vstinner for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington

miss-islington commented Sep 21, 2023

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@miss-islington miss-islington assigned vstinner Sep 21, 2023
@miss-islington

miss-islington commented Sep 21, 2023

Copy link
Copy Markdown
Contributor

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

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

vstinner pushed a commit to vstinner/cpython that referenced this pull request Sep 21, 2023
@sobolevn @vstinner
pythongh-108303: Move all math files to Lib/test/mathdata/ (python#…
4e61a59
…109512)

(cherry picked from commit ed587be)
@vstinner

vstinner commented Sep 21, 2023

Copy link
Copy Markdown
Member

Oh, this PR was outdated since PR #109548 got merged! I wrote PR #109686 to fix it.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

csm10495 pushed a commit to csm10495/cpython that referenced this pull request Sep 28, 2023
@sobolevn @csm10495
pythongh-108303: Move all math files to Lib/test/mathdata/ (python#…
08cdf0e
…109512)
Glyphack pushed a commit to Glyphack/cpython that referenced this pull request Sep 2, 2024
@sobolevn @Glyphack
pythongh-108303: Move all math files to Lib/test/mathdata/ (python#…
4ea0c4b
…109512)
@ZeroIntensity ZeroIntensity removed needs backport to 3.11 only security fixes needs backport to 3.12 only security fixes labels Feb 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@vstinner vstinner vstinner approved these changes
@serhiy-storchaka serhiy-storchaka serhiy-storchaka approved these changes
+1 more reviewer
@lizzydavis695 lizzydavis695 lizzydavis695 approved these changes
Reviewers whose approvals may not affect merge requirements

Uh oh!

There was an error while loading. Please reload this page.

Assignees

@vstinner vstinner

Labels

skip news

Projects

None yet

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.

7 participants

@sobolevn @serhiy-storchaka @vstinner @rhettinger @miss-islington @lizzydavis695 @ZeroIntensity
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.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.