summaryrefslogtreecommitdiff
path: root/Lib/test/test_abc.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_abc.py')
-rw-r--r--Lib/test/test_abc.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_abc.py b/Lib/test/test_abc.py
index af26c1d6b8..6fc3c95e4a 100644
--- a/Lib/test/test_abc.py
+++ b/Lib/test/test_abc.py
@@ -392,6 +392,24 @@ def test_factory(abc_ABCMeta, abc_get_cache_token):
self.assertIsInstance(42, A)
self.assertIsInstance(42, (A,))
+ def test_issubclass_bad_arguments(self):
+ class A(metaclass=abc_ABCMeta):
+ pass
+
+ with self.assertRaises(TypeError):
+ issubclass({}, A) # unhashable
+
+ with self.assertRaises(TypeError):
+ issubclass(42, A) # No __mro__
+
+ # Python version supports any iterable as __mro__.
+ # But it's implementation detail and don't emulate it in C version.
+ class C:
+ __mro__ = 42 # __mro__ is not tuple
+
+ with self.assertRaises(TypeError):
+ issubclass(C(), A)
+
def test_all_new_methods_are_called(self):
class A(metaclass=abc_ABCMeta):
pass