From 36f79523abe8d79fec1cc7af41e8e96e8ceb2cc4 Mon Sep 17 00:00:00 2001 From: Damien George Date: Thu, 14 Dec 2017 12:25:30 +1100 Subject: tests: Add tests to improve coverage of py/objtype.c. --- tests/misc/non_compliant.py | 15 +++++++++++++++ tests/misc/non_compliant.py.exp | 2 ++ 2 files changed, 17 insertions(+) (limited to 'tests/misc') diff --git a/tests/misc/non_compliant.py b/tests/misc/non_compliant.py index 152633c3b..31129f075 100644 --- a/tests/misc/non_compliant.py +++ b/tests/misc/non_compliant.py @@ -124,3 +124,18 @@ try: f.x = 1 except AttributeError: print('AttributeError') + +# can't call a function type (ie make new instances of a function) +try: + type(f)() +except TypeError: + print('TypeError') + +# test when object explicitly listed at not-last position in parent tuple +# this is not compliant with CPython because of illegal MRO +class A: + def foo(self): + print('A.foo') +class B(object, A): + pass +B().foo() diff --git a/tests/misc/non_compliant.py.exp b/tests/misc/non_compliant.py.exp index 9c157fd5b..061e3fcc8 100644 --- a/tests/misc/non_compliant.py.exp +++ b/tests/misc/non_compliant.py.exp @@ -18,3 +18,5 @@ b'\x01\x02' b'\x01\x00' NotImplementedError AttributeError +TypeError +A.foo -- cgit v1.2.3