diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-12-20 22:14:45 -0600 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-12-20 22:14:45 -0600 |
commit | 54e88aec5f7156dd6dcd440abb5b7e81cdb38ca5 (patch) | |
tree | 69e08818d2bfa52962e846ac01bbdbf0dc86f9e5 /test_six.py | |
parent | 4ba1d2432cbb5217226194b5a3941c6de01fef6e (diff) | |
download | six-54e88aec5f7156dd6dcd440abb5b7e81cdb38ca5.tar.gz |
fix add_metaclass when __slots__ is a string (fixes #47)
Diffstat (limited to 'test_six.py')
-rw-r--r-- | test_six.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py index 81b424f..7f92617 100644 --- a/test_six.py +++ b/test_six.py @@ -630,3 +630,14 @@ def test_add_metaclass(): instance = MySlots() instance.a = "foo" py.test.raises(AttributeError, setattr, instance, "c", "baz") + + # Test a class with string for slots. + class MyStringSlots(object): + __slots__ = "ab" + MyStringSlots = six.add_metaclass(Meta1)(MyStringSlots) + assert MyStringSlots.__slots__ == "ab" + instance = MyStringSlots() + instance.ab = "foo" + py.test.raises(AttributeError, setattr, instance, "a", "baz") + py.test.raises(AttributeError, setattr, instance, "b", "baz") + |