aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_fractions.py
diff options
context:
space:
mode:
authorRaymond Hettinger <rhettinger@users.noreply.github.com>2022-09-02 11:10:58 -0500
committerGitHub <noreply@github.com>2022-09-02 11:10:58 -0500
commit656167db81a53934da55d90ed431449d8a4fc14b (patch)
tree7c7a16ea4f63ee2b8557cc8496549f4dd79dc18e /Lib/test/test_fractions.py
parent91f40f3f78d6016a283989e32ec3d1fb61bcebca (diff)
downloadcpython-656167db81a53934da55d90ed431449d8a4fc14b.tar.gz
cpython-656167db81a53934da55d90ed431449d8a4fc14b.zip
Allow whitespace around a slash in fraction string inputs (GH-96496)
Diffstat (limited to 'Lib/test/test_fractions.py')
-rw-r--r--Lib/test/test_fractions.py4
1 files changed, 1 insertions, 3 deletions
diff --git a/Lib/test/test_fractions.py b/Lib/test/test_fractions.py
index fc46e8674fc..7fa9dbea905 100644
--- a/Lib/test/test_fractions.py
+++ b/Lib/test/test_fractions.py
@@ -162,6 +162,7 @@ class FractionTest(unittest.TestCase):
def testFromString(self):
self.assertEqual((5, 1), _components(F("5")))
self.assertEqual((3, 2), _components(F("3/2")))
+ self.assertEqual((3, 2), _components(F("3 / 2")))
self.assertEqual((3, 2), _components(F(" \n +3/2")))
self.assertEqual((-3, 2), _components(F("-3/2 ")))
self.assertEqual((13, 2), _components(F(" 013/02 \n ")))
@@ -191,9 +192,6 @@ class FractionTest(unittest.TestCase):
ValueError, "Invalid literal for Fraction: '/2'",
F, "/2")
self.assertRaisesMessage(
- ValueError, "Invalid literal for Fraction: '3 /2'",
- F, "3 /2")
- self.assertRaisesMessage(
# Denominators don't need a sign.
ValueError, "Invalid literal for Fraction: '3/+2'",
F, "3/+2")