summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_float.py
diff options
context:
space:
mode:
authorKirill Podoprigora <kirill.bast9@mail.ru>2024-06-07 08:03:28 (GMT)
committerGitHub <noreply@github.com>2024-06-07 08:03:28 (GMT)
commit57ad769076201c858a768d81047f6ea44925a33b (patch)
treef6dc9e6cbdd2732be17f6029bc795396d80c809b /Lib/test/test_float.py
parentbd826b9c77dbf7c789433cb8061c733c08634c0e (diff)
downloadcpython-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.py6
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