diff options
Diffstat (limited to 'Lib/test/test_descr.py')
-rw-r--r-- | Lib/test/test_descr.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_descr.py b/Lib/test/test_descr.py index 755a967..3c607f7 100644 --- a/Lib/test/test_descr.py +++ b/Lib/test/test_descr.py @@ -1182,6 +1182,24 @@ order (MRO) for bases """ a.foo = 42 self.assertEqual(a.__dict__, {"foo": 42}) + def test_slots_descriptor(self): + # Issue2115: slot descriptors did not correctly check + # the type of the given object + import abc + class MyABC: + __metaclass__ = abc.ABCMeta + __slots__ = "a" + + class Unrelated(object): + pass + MyABC.register(Unrelated) + + u = Unrelated() + self.assert_(isinstance(u, MyABC)) + + # This used to crash + self.assertRaises(TypeError, MyABC.a.__set__, u, 3) + def test_dynamics(self): # Testing class attribute propagation... class D(object): |