diff options
author | Kirill Podoprigora <kirill.bast9@mail.ru> | 2024-06-07 08:03:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-07 08:03:28 (GMT) |
commit | 57ad769076201c858a768d81047f6ea44925a33b (patch) | |
tree | f6dc9e6cbdd2732be17f6029bc795396d80c809b /Lib/test/test_float.py | |
parent | bd826b9c77dbf7c789433cb8061c733c08634c0e (diff) | |
download | cpython-57ad769076201c858a768d81047f6ea44925a33b.zip cpython-57ad769076201c858a768d81047f6ea44925a33b.tar.gz cpython-57ad769076201c858a768d81047f6ea44925a33b.tar.bz2 |
gh-120080: Accept ``None`` as a valid argument for direct call of the ``int.__round__`` (#120088)
Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r-- | Lib/test/test_float.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 5bd6406..53695ce 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -949,6 +949,12 @@ class RoundTestCase(unittest.TestCase): self.assertEqual(x, 2) self.assertIsInstance(x, int) + def test_round_with_none_arg_direct_call(self): + for val in [(1.0).__round__(None), + round(1.0), + round(1.0, None)]: + self.assertEqual(val, 1) + self.assertIs(type(val), int) # Beginning with Python 2.6 float has cross platform compatible # ways to create and represent inf and nan |