diff options
author | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-01-17 07:36:30 +0000 |
---|---|---|
committer | Jeffrey Yasskin <jyasskin@gmail.com> | 2008-01-17 07:36:30 +0000 |
commit | 9893de1b83978249eafaebe575989537c01b484e (patch) | |
tree | 25f465a8eba333743569badfb2783e13c8a8b2f8 /Lib/test/test_rational.py | |
parent | 35641461db7c692877ffa4bbbfe31a525c81770e (diff) | |
download | cpython-git-9893de1b83978249eafaebe575989537c01b484e.tar.gz |
Update the py3k version of the rational module to expose only methods needed by
py3k (i.e., no __div__) and use py3k functions like math.floor().
Diffstat (limited to 'Lib/test/test_rational.py')
-rw-r--r-- | Lib/test/test_rational.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/Lib/test/test_rational.py b/Lib/test/test_rational.py index cd8c709bd6..952a97fa62 100644 --- a/Lib/test/test_rational.py +++ b/Lib/test/test_rational.py @@ -74,14 +74,14 @@ class RationalTest(unittest.TestCase): def testConversions(self): self.assertTypedEquals(-1, trunc(R(-11, 10))) - self.assertTypedEquals(-2, R(-11, 10).__floor__()) - self.assertTypedEquals(-1, R(-11, 10).__ceil__()) - self.assertTypedEquals(-1, R(-10, 10).__ceil__()) + self.assertTypedEquals(-2, math.floor(R(-11, 10))) + self.assertTypedEquals(-1, math.ceil(R(-11, 10))) + self.assertTypedEquals(-1, math.ceil(R(-10, 10))) - self.assertTypedEquals(0, R(-1, 10).__round__()) - self.assertTypedEquals(0, R(-5, 10).__round__()) - self.assertTypedEquals(-2, R(-15, 10).__round__()) - self.assertTypedEquals(-1, R(-7, 10).__round__()) + self.assertTypedEquals(0, round(R(-1, 10))) + self.assertTypedEquals(0, round(R(-5, 10))) + self.assertTypedEquals(-2, round(R(-15, 10))) + self.assertTypedEquals(-1, round(R(-7, 10))) self.assertEquals(False, bool(R(0, 1))) self.assertEquals(True, bool(R(3, 2))) @@ -96,11 +96,11 @@ class RationalTest(unittest.TestCase): self.assertTypedEquals(0.1+0j, complex(R(1,10))) def testRound(self): - self.assertTypedEquals(R(-200), R(-150).__round__(-2)) - self.assertTypedEquals(R(-200), R(-250).__round__(-2)) - self.assertTypedEquals(R(30), R(26).__round__(-1)) - self.assertTypedEquals(R(-2, 10), R(-15, 100).__round__(1)) - self.assertTypedEquals(R(-2, 10), R(-25, 100).__round__(1)) + self.assertTypedEquals(R(-200), round(R(-150), -2)) + self.assertTypedEquals(R(-200), round(R(-250), -2)) + self.assertTypedEquals(R(30), round(R(26), -1)) + self.assertTypedEquals(R(-2, 10), round(R(-15, 100), 1)) + self.assertTypedEquals(R(-2, 10), round(R(-25, 100), 1)) def testArithmetic(self): |