diff options
author | Benjamin Peterson <benjamin@python.org> | 2012-04-24 18:44:18 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2012-04-24 18:44:18 (GMT) |
commit | 15ee821eb50b1d764fad358d7a9ce9f32813d4ee (patch) | |
tree | 9011c797637bcfb98719f9966dbe62500d401dfa /Lib | |
parent | 17feca0efc1bb49925f798a7de8eb164f5bdc98b (diff) | |
download | cpython-15ee821eb50b1d764fad358d7a9ce9f32813d4ee.zip cpython-15ee821eb50b1d764fad358d7a9ce9f32813d4ee.tar.gz cpython-15ee821eb50b1d764fad358d7a9ce9f32813d4ee.tar.bz2 |
distiguish between refusing to creating shared keys and error (#13903)
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_dict.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_dict.py b/Lib/test/test_dict.py index cdd8b6c..426f76e 100644 --- a/Lib/test/test_dict.py +++ b/Lib/test/test_dict.py @@ -889,6 +889,13 @@ class DictTest(unittest.TestCase): self.assertEqual(f.msg, getattr(f, _str('msg'))) self.assertEqual(f.msg, f.__dict__[_str('msg')]) + def test_object_set_item_single_instance_non_str_key(self): + class Foo: pass + f = Foo() + f.__dict__[1] = 1 + f.a = 'a' + self.assertEqual(f.__dict__, {1:1, 'a':'a'}) + from test import mapping_tests class GeneralMappingTests(mapping_tests.BasicTestMappingProtocol): |