[3.11] gh-104411: Update test_getint for Tcl 9.0 (GH-104412) (#105357)

gh-104411: Update test_getint for Tcl 9.0 (GH-104412)
(cherry picked from commit 2c49c759e8)

Co-authored-by: Christopher Chavez <chrischavez@gmx.us>
This commit is contained in:
Miss Islington (bot) 2023-06-06 07:04:21 -07:00 committed by GitHub
parent c644fe403a
commit daf22ca7f9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -145,7 +145,10 @@ def test_getint(self):
for i in self.get_integers(): for i in self.get_integers():
self.assertEqual(tcl.getint(' %d ' % i), i) self.assertEqual(tcl.getint(' %d ' % i), i)
self.assertEqual(tcl.getint(' %#o ' % 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(' %#x ' % i), i)
self.assertEqual(tcl.getint(42), 42) self.assertEqual(tcl.getint(42), 42)
self.assertRaises(TypeError, tcl.getint) self.assertRaises(TypeError, tcl.getint)