Skip to content

bpo-46820: Refactor tests for ambiguous end of numerical literal #31494

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Feb 22, 2022

with self.assertWarns(DeprecationWarning):
compile(test, "<testcase>", "eval")

for num in "0xf", "0o7", "0b1", "9", "0", "1.", "1e3", "1j":
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is now a better time to suggest adding an underscore literal 1_000?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are too many different use cases with underscores: 0x_f, 0x1_f, 0o_7, 0o1_7, 0b_1, 0b1_1, 1., 1_0., 1.0_0, etc. And none of them is related because an underscore cannot ends the numeric literal, and it does not affect interpretation of other characters.

It will increase test coverage.

@miss-islington
Copy link
Contributor

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the test_end_of_numerical_literals branch February 25, 2022 08:25
@bedevere-bot
Copy link

GH-31566 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Feb 25, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Feb 25, 2022
miss-islington added a commit that referenced this pull request Feb 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip news tests Tests in the Lib/test dir
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants