summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_rational.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_rational.py')
-rw-r--r--Lib/test/test_rational.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/Lib/test/test_rational.py b/Lib/test/test_rational.py
index c9a129f..4f248be 100644
--- a/Lib/test/test_rational.py
+++ b/Lib/test/test_rational.py
@@ -77,6 +77,8 @@ class RationalTest(unittest.TestCase):
self.assertEquals((3, 2), _components(R(" 03/02 \n ")))
self.assertEquals((16, 5), _components(R(" 3.2 ")))
self.assertEquals((-16, 5), _components(R(" -3.2 ")))
+ self.assertEquals((-3, 1), _components(R(" -3. ")))
+ self.assertEquals((3, 5), _components(R(" .6 ")))
self.assertRaisesMessage(
ZeroDivisionError, "Rational(3, 0)",
@@ -111,6 +113,10 @@ class RationalTest(unittest.TestCase):
# Don't accept combinations of decimals and rationals.
ValueError, "Invalid literal for Rational: 3.2/7",
R, "3.2/7")
+ self.assertRaisesMessage(
+ # Allow 3. and .3, but not .
+ ValueError, "Invalid literal for Rational: .",
+ R, ".")
def testImmutable(self):
r = R(7, 3)