diff options
author | Steve Dower <steve.dower@microsoft.com> | 2015-04-15 20:10:59 (GMT) |
---|---|---|
committer | Steve Dower <steve.dower@microsoft.com> | 2015-04-15 20:10:59 (GMT) |
commit | cb39d1f466eeecbec969f50a5df609eb0a863084 (patch) | |
tree | cd4fd87d2cc51a15730a5e061075a5da8e069b9b /Lib/test/test_float.py | |
parent | 807b80d4ec9d9dd2c0f5e6a4bf07caa7c90625e1 (diff) | |
download | cpython-cb39d1f466eeecbec969f50a5df609eb0a863084.zip cpython-cb39d1f466eeecbec969f50a5df609eb0a863084.tar.gz cpython-cb39d1f466eeecbec969f50a5df609eb0a863084.tar.bz2 |
Issue 19933: Provide default argument for ndigits in round. Patch by Vajrasky Kok.
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r-- | Lib/test/test_float.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py index 071d217..4251090 100644 --- a/Lib/test/test_float.py +++ b/Lib/test/test_float.py @@ -773,6 +773,14 @@ class RoundTestCase(unittest.TestCase): test(sfmt, NAN, ' nan') test(sfmt, -NAN, ' nan') + def test_None_ndigits(self): + for x in round(1.23), round(1.23, None), round(1.23, ndigits=None): + self.assertEqual(x, 1) + self.assertIsInstance(x, int) + for x in round(1.78), round(1.78, None), round(1.78, ndigits=None): + self.assertEqual(x, 2) + self.assertIsInstance(x, int) + # Beginning with Python 2.6 float has cross platform compatible # ways to create and represent inf and nan |