| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| @@ -57,6 +57,9 @@ A small number of constants live in the built-in namespace. They are: | |||
| it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. | |||
| It will raise a :exc:`TypeError` in a future version of Python. | |||
There was a problem hiding this comment.
This can be removed. And maybe the whole text of the note can be reworded.
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, I'll submit another PR addressing your comments.
Sorry, something went wrong.
| @@ -174,6 +174,9 @@ for more details. | |||
| it currently evaluates as true, it will emit a :exc:`DeprecationWarning`. | |||
| It will raise a :exc:`TypeError` in a future version of Python. | |||
There was a problem hiding this comment.
This can be removed.
Sorry, something went wrong.
| # a TypeError). | ||
| self.assertWarns(DeprecationWarning, bool, NotImplemented) | ||
| with self.assertWarns(DeprecationWarning): | ||
| self.assertRaises(TypeError, bool, NotImplemented) |
There was a problem hiding this comment.
The test should be renamed.
Sorry, something went wrong.
| self.assertWarns(DeprecationWarning, bool, NotImplemented) | ||
| with self.assertWarns(DeprecationWarning): | ||
| self.assertRaises(TypeError, bool, NotImplemented) | ||
| with self.assertRaises(TypeError): |
There was a problem hiding this comment.
TypeError is raised when you just call a function with wrong number of arguments, for example:
with self.assertRaises(TypeError):
self.assertEqual(NotImplemented)It is better to not use assertTrue() (which does not work here), but directly test the boolean value:
if NotImplemented:
pass
Sorry, something went wrong.
There was a problem hiding this comment.
I'll also change it to use assertRaisesRegex to test that we're getting the expected TypeError and not some other one.
Sorry, something went wrong.
| @@ -0,0 +1,2 @@ | |||
| Using :data:`NotImplemented` in a boolean context now raises | |||
| :exc:`TypeError`. Contributed by Jelle Zijlstra in :gh:`118767`. | |||
There was a problem hiding this comment.
Isn't the link to the issue already included in the changelog?
Sorry, something went wrong.
There was a problem hiding this comment.
Thanks, fixed in the new PR.
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
>>> bool(NotImplemented) Traceback (most recent call last): File "<python-input-0>", line 1, in <module> bool(NotImplemented) ~~~~^^^^^^^^^^^^^^^^ TypeError: NotImplemented should not be used in a boolean context📚 Documentation preview 📚: https://cpython-previews--118775.org.readthedocs.build/