summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-08-11 16:16:53 (GMT)
committerGitHub <noreply@github.com>2022-08-11 16:16:53 (GMT)
commit3ea9ba647850442ade8aec2c84c7f20afd0fb7c4 (patch)
treedc188836e4691b78b42cc47c17cd07094337019b /Lib/test
parent731732aa8bf71b84e4bc1dfead27f524eb710fce (diff)
downloadcpython-3ea9ba647850442ade8aec2c84c7f20afd0fb7c4.zip
cpython-3ea9ba647850442ade8aec2c84c7f20afd0fb7c4.tar.gz
cpython-3ea9ba647850442ade8aec2c84c7f20afd0fb7c4.tar.bz2
gh-95605: Fix `float(s)` error message when `s` contains only whitespace (GH-95665) (GH-95858)
This PR fixes the error message from float(s) in the case where s contains only whitespace. (cherry picked from commit 97e9cfa75a80b54a0630b7371f35e368a12749d1) Co-authored-by: Mark Dickinson <dickinsm@gmail.com>
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_float.py4
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/test_float.py b/Lib/test/test_float.py
index e992501..304388e 100644
--- a/Lib/test/test_float.py
+++ b/Lib/test/test_float.py
@@ -138,6 +138,10 @@ class GeneralFloatCases(unittest.TestCase):
check('123\xbd')
check(' 123 456 ')
check(b' 123 456 ')
+ # all whitespace (cf. https://github.com/python/cpython/issues/95605)
+ check('')
+ check(' ')
+ check('\t \n')
# non-ascii digits (error came from non-digit '!')
check('\u0663\u0661\u0664!')