summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_float.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_float.py')
-rw-r--r--Lib/test/test_float.py23
1 files changed, 9 insertions, 14 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index e87aab0..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
@@ -1299,18 +1307,5 @@ class HexFloatTestCase(unittest.TestCase):
self.identical(x, fromHex(toHex(x)))
-def test_main():
- support.run_unittest(
- GeneralFloatCases,
- FormatFunctionsTestCase,
- UnknownFormatTestCase,
- IEEEFormatTestCase,
- FormatTestCase,
- ReprTestCase,
- RoundTestCase,
- InfNanTest,
- HexFloatTestCase,
- )
-
if __name__ == '__main__':
- test_main()
+ unittest.main()