summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2023-06-06 14:04:07 (GMT)
committerGitHub <noreply@github.com>2023-06-06 14:04:07 (GMT)
commit260ba1fcdba860ab298c530af8c5340eb8b2c021 (patch)
tree707d9621428ede3594185492d284132abb9e35be
parent27cbeb08b80138d093b9b08eb41744d249c386e6 (diff)
downloadcpython-260ba1fcdba860ab298c530af8c5340eb8b2c021.zip
cpython-260ba1fcdba860ab298c530af8c5340eb8b2c021.tar.gz
cpython-260ba1fcdba860ab298c530af8c5340eb8b2c021.tar.bz2
[3.12] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (#105356)
gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (cherry picked from commit 2c49c759e880a32539f50c31dbd35d2bc4b4e030) Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
-rw-r--r--Lib/test/test_tcl.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
index cd79024..d07b83a 100644
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -142,7 +142,10 @@ class TclTest(unittest.TestCase):
for i in self.get_integers():
self.assertEqual(tcl.getint(' %d ' % i), i)
self.assertEqual(tcl.getint(' %#o ' % i), i)
- self.assertEqual(tcl.getint((' %#o ' % i).replace('o', '')), i)
+ # Numbers starting with 0 are parsed as decimal in Tcl 9.0
+ # and as octal in older versions.
+ self.assertEqual(tcl.getint((' %#o ' % i).replace('o', '')),
+ i if tcl_version < (9, 0) else int('%o' % i))
self.assertEqual(tcl.getint(' %#x ' % i), i)
self.assertEqual(tcl.getint(42), 42)
self.assertRaises(TypeError, tcl.getint)