summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tcl.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-02-07 13:40:03 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-02-07 13:40:03 (GMT)
commitdf4bb46457b5bac4affd01926df6a2fb61bc7d19 (patch)
tree740f78b0e834812ebfb57629e4b4fcd2df84c1f8 /Lib/test/test_tcl.py
parent899530029899b6602e7ef880765170b3a24d3e5a (diff)
downloadcpython-df4bb46457b5bac4affd01926df6a2fb61bc7d19.zip
cpython-df4bb46457b5bac4affd01926df6a2fb61bc7d19.tar.gz
cpython-df4bb46457b5bac4affd01926df6a2fb61bc7d19.tar.bz2
Issue #17118: Add new tests for testing Python-Tcl interaction.
Diffstat (limited to 'Lib/test/test_tcl.py')
-rw-r--r--Lib/test/test_tcl.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_tcl.py b/Lib/test/test_tcl.py
index d86246c..d38c0b5 100644
--- a/Lib/test/test_tcl.py
+++ b/Lib/test/test_tcl.py
@@ -151,6 +151,26 @@ class TclTest(unittest.TestCase):
# exit code must be zero
self.assertEqual(f.close(), None)
+ def test_passing_values(self):
+ def passValue(value):
+ return self.interp.call('set', '_', value)
+
+ self.assertEqual(passValue(True), True)
+ self.assertEqual(passValue(False), False)
+ self.assertEqual(passValue('string'), 'string')
+ self.assertEqual(passValue('string\u20ac'), 'string\u20ac')
+ for i in (0, 1, -1, 2**31-1, -2**31):
+ self.assertEqual(passValue(i), i)
+ for f in (0.0, 1.0, -1.0, 1/3,
+ sys.float_info.min, sys.float_info.max,
+ -sys.float_info.min, -sys.float_info.max):
+ self.assertEqual(passValue(f), f)
+ for f in float('nan'), float('inf'), -float('inf'):
+ if f != f: # NaN
+ self.assertNotEqual(passValue(f), f)
+ else:
+ self.assertEqual(passValue(f), f)
+ self.assertEqual(passValue((1, '2', (3.4,))), (1, '2', (3.4,)))
def test_main():