diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2022-09-02 11:10:58 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-09-02 11:10:58 -0500 |
commit | 656167db81a53934da55d90ed431449d8a4fc14b (patch) | |
tree | 7c7a16ea4f63ee2b8557cc8496549f4dd79dc18e /Lib/test/test_fractions.py | |
parent | 91f40f3f78d6016a283989e32ec3d1fb61bcebca (diff) | |
download | cpython-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.py | 4 |
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") |