summaryrefslogtreecommitdiff
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.py18
1 files changed, 14 insertions, 4 deletions
diff --git a/Lib/test/test_tuple.py b/Lib/test/test_tuple.py
index 51875a1cbd..fb113ab29a 100644
--- a/Lib/test/test_tuple.py
+++ b/Lib/test/test_tuple.py
@@ -6,6 +6,11 @@ import pickle
class TupleTest(seq_tests.CommonTest):
type2test = tuple
+ def test_getitem_error(self):
+ msg = "tuple indices must be integers or slices"
+ with self.assertRaisesRegex(TypeError, msg):
+ ()['a']
+
def test_constructors(self):
super().test_constructors()
# calling built-in types without argument must return empty
@@ -203,8 +208,13 @@ class TupleTest(seq_tests.CommonTest):
with self.assertRaises(TypeError):
[3,] + T((1,2))
-def test_main():
- support.run_unittest(TupleTest)
+ def test_lexicographic_ordering(self):
+ # Issue 21100
+ a = self.type2test([1, 2])
+ b = self.type2test([1, 2, 0])
+ c = self.type2test([1, 3])
+ self.assertLess(a, b)
+ self.assertLess(b, c)
-if __name__=="__main__":
- test_main()
+if __name__ == "__main__":
+ unittest.main()