From 1aaba5cabe48fa5168279a51f62124bbfedd5d59 Mon Sep 17 00:00:00 2001 From: Paul Sokolovsky Date: Wed, 6 Sep 2017 00:23:41 +0300 Subject: py/objtuple: Properly implement comparison with incompatible types. Should raise TypeError, unless it's (in)equality comparison. --- tests/basics/tuple_compare.py | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'tests/basics/tuple_compare.py') diff --git a/tests/basics/tuple_compare.py b/tests/basics/tuple_compare.py index ad813f7029..9558eb1db4 100644 --- a/tests/basics/tuple_compare.py +++ b/tests/basics/tuple_compare.py @@ -53,3 +53,13 @@ print((10, 0) > (1, 1)) print((10, 0) < (1, 1)) print((0, 0, 10, 0) > (0, 0, 1, 1)) print((0, 0, 10, 0) < (0, 0, 1, 1)) + + +print(() == {}) +print(() != {}) +print((1,) == [1]) + +try: + print(() < {}) +except TypeError: + print("TypeError") -- cgit v1.2.3