← 返回首页
gh-94808: Coverage: Test uppercase string literal prefixes by mdboom · Pull Request #95925 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-94808: Coverage: Test uppercase string literal prefixes#95925

Merged
serhiy-storchaka merged 3 commits into
python:mainfrom
mdboom:coverage-upper-case-literal-prefixes
Sep 24, 2022
Merged

gh-94808: Coverage: Test uppercase string literal prefixes#95925
serhiy-storchaka merged 3 commits into
python:mainfrom
mdboom:coverage-upper-case-literal-prefixes

Conversation

mdboom commented Aug 12, 2022
edited by bedevere-bot
Loading

Copy link
Copy Markdown
Contributor

Comment thread Lib/test/test_string_literals.py Outdated
self.assertEqual(eval(r""" R'\x01' """), '\\x01')
self.assertEqual(eval(r""" BR'\x01' """), b'\\' + b'x01')
self.assertEqual(eval(""" F'{1+1}' """), '2')
self.assertEqual(eval(""" U'\U0001d120' """), '\U0001d120')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Presumably the lowercase versions are covered by other tests (right?)

Would it be simpler here to just assert in each case that the lowercase and upper case prefixes generate the same thing? For instance, self.assertEqual(eval(""" F'{1+1}' """), eval(""" f'{1+1}' """)).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

That's a good idea. Updated.

Copy link
Copy Markdown
Member

mdboom requested a review from iritkatriel September 22, 2022 14:05
Comment thread Lib/test/test_string_literals.py Outdated
self.assertEqual(eval(r""" R'\x01' """), r'\x01')
self.assertEqual(eval(r""" BR'\x01' """), br'\x01')
self.assertEqual(eval(""" F'{1+1}' """), f'{1+1}')
self.assertEqual(eval(""" U'\U0001d120' """), u'\U0001d120')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

Actually do we need the eval() calls?

Comment thread Lib/test/test_string_literals.py Outdated Show resolved Hide resolved
serhiy-storchaka merged commit f00383e into python:main Sep 24, 2022

Copy link
Copy Markdown
Contributor

Thanks @mdboom for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

Copy link
Copy Markdown

GH-97518 is a backport of this pull request to the 3.11 branch.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 24, 2022
…honGH-95925) (cherry picked from commit f00383e) Co-authored-by: Michael Droettboom <mdboom@gmail.com>
miss-islington added a commit that referenced this pull request Sep 25, 2022
(cherry picked from commit f00383e) Co-authored-by: Michael Droettboom <mdboom@gmail.com>
serhiy-storchaka added the needs backport to 3.10 only security fixes label Sep 25, 2022

Copy link
Copy Markdown
Contributor

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

bedevere-bot removed the needs backport to 3.10 only security fixes label Sep 25, 2022

Copy link
Copy Markdown

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

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Sep 25, 2022
…honGH-95925) (cherry picked from commit f00383e) Co-authored-by: Michael Droettboom <mdboom@gmail.com>
miss-islington added a commit that referenced this pull request Sep 25, 2022
(cherry picked from commit f00383e) Co-authored-by: Michael Droettboom <mdboom@gmail.com>
mdboom deleted the coverage-upper-case-literal-prefixes branch December 22, 2022 15:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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

Footer

© 2026 GitHub, Inc.