From 287719c22d28d404c7944b2abecc8644bf348f49 Mon Sep 17 00:00:00 2001 From: Jozef Knaperek Date: Mon, 13 Mar 2017 18:22:56 +0100 Subject: [PATCH] Add test for oldstyle class handling --- tests/test_subclasshook.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/test_subclasshook.py b/tests/test_subclasshook.py index 369ce77..19e9cf1 100644 --- a/tests/test_subclasshook.py +++ b/tests/test_subclasshook.py @@ -15,6 +15,15 @@ class DumbBidirectionalMapping(dict): return DumbBidirectionalMapping(self.__inverted__()) +class OldstyleClass(): + """ + Old-style class (not derived from object). + This used to crash due to missing __mro__ attribute that is not present + in oldstyle classes. + """ + + def test_subclasshook(): assert issubclass(DumbBidirectionalMapping, BidirectionalMapping) assert not issubclass(dict, BidirectionalMapping) + assert not issubclass(OldstyleClass, BidirectionalMapping)