summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_tuple.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_tuple.py')
-rw-r--r--Lib/test/test_tuple.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index f583747..6e934fb 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -96,6 +96,7 @@ class TupleTest(seq_tests.CommonTest):
gc.collect()
self.assertTrue(gc.is_tracked(t), t)
+ @support.cpython_only
def test_track_literals(self):
# Test GC-optimization of tuple literals
x, y, z = 1.5, "a", []
@@ -136,20 +137,41 @@ class TupleTest(seq_tests.CommonTest):
self._tracked(tp(tuple([obj]) for obj in [x, y, z]))
self._tracked(tuple(tp([obj]) for obj in [x, y, z]))
+ @support.cpython_only
def test_track_dynamic(self):
# Test GC-optimization of dynamically constructed tuples.
self.check_track_dynamic(tuple, False)
+ @support.cpython_only
def test_track_subtypes(self):
# Tuple subtypes must always be tracked
class MyTuple(tuple):
pass
self.check_track_dynamic(MyTuple, True)
+ @support.cpython_only
def test_bug7466(self):
# Trying to untrack an unfinished tuple could crash Python
self._not_tracked(tuple(gc.collect() for i in range(101)))
+ def test_repr_large(self):
+ # Check the repr of large list objects
+ def check(n):
+ l = (0,) * n
+ s = repr(l)
+ self.assertEqual(s,
+ '(' + ', '.join(['0'] * n) + ')')
+ check(10) # check our checking code
+ check(1000000)
+
+ def test_no_comdat_folding(self):
+ # Issue 8847: In the PGO build, the MSVC linker's COMDAT folding
+ # optimization causes failures in code that relies on distinct
+ # function addresses.
+ class T(tuple): pass
+ with self.assertRaises(TypeError):
+ [3,] + T((1,2))
+
def test_main():
support.run_unittest(TupleTest)