summaryrefslogtreecommitdiff
path: root/Lib/test/test_fractions.py
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2009-04-24 14:06:19 +0000
committerMark Dickinson <dickinsm@gmail.com>2009-04-24 14:06:19 +0000
commitd4d95f8eac4718809cfb68f97c9881586596100a (patch)
treed9a603aa84d7d9f45a0937ae91163e8f2d4153de /Lib/test/test_fractions.py
parentf21bd3cc2f5c7def415677dae85ea9383c7a571d (diff)
downloadcpython-git-d4d95f8eac4718809cfb68f97c9881586596100a.tar.gz
Merged revisions 71832 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r71832 | mark.dickinson | 2009-04-24 14:56:07 +0100 (Fri, 24 Apr 2009) | 3 lines Issue #5812: The two-argument form of the Fraction constructor now accepts arbitrary Rational instances. ........
Diffstat (limited to 'Lib/test/test_fractions.py')
-rw-r--r--Lib/test/test_fractions.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index 448e32da53..e32191452c 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -60,13 +60,19 @@ class FractionTest(unittest.TestCase):
self.assertEquals((7, 15), _components(F(7, 15)))
self.assertEquals((10**23, 1), _components(F(10**23)))
+ self.assertEquals((3, 77), _components(F(F(3, 7), 11)))
+ self.assertEquals((-9, 5), _components(F(2, F(-10, 9))))
+ self.assertEquals((2486, 2485), _components(F(F(22, 7), F(355, 113))))
+
self.assertRaisesMessage(ZeroDivisionError, "Fraction(12, 0)",
F, 12, 0)
self.assertRaises(TypeError, F, 1.5)
self.assertRaises(TypeError, F, 1.5 + 3j)
- self.assertRaises(TypeError, F, F(1, 2), 3)
self.assertRaises(TypeError, F, "3/2", 3)
+ self.assertRaises(TypeError, F, 3, 0j)
+ self.assertRaises(TypeError, F, 3, 1j)
+
def testFromString(self):
self.assertEquals((5, 1), _components(F("5")))