Visitar URL original
bpo-44564 Move formatted assertion under deprecation warning context. by brandonschabell · Pull Request #27090 · python/cpython · GitHub
The Wayback Machine - https://web.archive.org/web/20250819001749/https://github.com/python/cpython/pull/27090
Skip to content

bpo-44564 Move formatted assertion under deprecation warning context. #27090

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
merged 1 commit into from
Aug 4, 2021

Conversation

brandonschabell
Copy link
Contributor

@brandonschabell brandonschabell commented Jul 12, 2021 •

bpo-44564

One of the format calls in the test_custom_strenum_with_warning test wasn't under the DeprecationWarning context manager.

https://bugs.python.org/issue44564

@the-knights-who-say-ni
Copy link

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

CLA Missing

Our records indicate the following people have not signed the CLA:

@brandonschabell

For legal reasons we need all the people listed to sign the CLA before we can look at your contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

If you have recently signed the CLA, please wait at least one business day
before our records are updated.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

Comment on lines 2321 to +2324
self.assertEqual(str(OkayEnum.one), 'one')
with self.assertWarns(DeprecationWarning):
self.assertEqual('{}'.format(OkayEnum.one), '1')
self.assertEqual(OkayEnum.one, '{}'.format(OkayEnum.one))
self.assertEqual(OkayEnum.one, '{}'.format(OkayEnum.one))
Copy link
Contributor

@dlax dlax Jul 29, 2021 •

Choose a reason for hiding this comment

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

This indeed resolves the warning, but I wonder if this assertion is useful at all since we already check that '{}'.format(OkayEnum.one) == '1' (the line above) and that OkayEnum.one == '1' (3 lines above). Perhaps it can just be removed?

@ambv ambv merged commit f99c015 into python:main Aug 4, 2021
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.

6 participants