py23_test: add test for second None argument

This commit is contained in:
Cosimo Lupo 2016-12-02 12:15:01 +00:00
parent e7867529ad
commit c02ac33e35
No known key found for this signature in database
GPG Key ID: B61AAAD0B53A6419

View File

@ -164,6 +164,12 @@ class Round3Test(unittest.TestCase):
# floats should be illegal
self.assertRaises(TypeError, round3, 3.14159, 2.0)
# None should be allowed
self.assertEqual(round3(1.0, None), 1)
# the following would raise an error with the built-in Python3.5 round:
# TypeError: 'NoneType' object cannot be interpreted as an integer
self.assertEqual(round3(1, None), 1)
def test_halfway_cases(self):
self.assertAlmostEqual(round3(0.125, 2), 0.12)
self.assertAlmostEqual(round3(0.375, 2), 0.38)