diff options
author | Benjamin Peterson <benjamin@python.org> | 2013-03-23 22:32:00 -0500 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2013-03-23 22:32:00 -0500 |
commit | da2c7ebd234fc904f6d6de2191eb5f72e8992c95 (patch) | |
tree | fe5ea090417c5bb6a82e9ea3a7d1421b5227127b /Lib/test/string_tests.py | |
parent | 7e2f197a2bc3d15ff8c504154f48a3c2435c992f (diff) | |
download | cpython-git-da2c7ebd234fc904f6d6de2191eb5f72e8992c95.tar.gz |
allow any type with __getitem__ to be a mapping for the purposes of % (#15801)
Diffstat (limited to 'Lib/test/string_tests.py')
-rw-r--r-- | Lib/test/string_tests.py | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Lib/test/string_tests.py b/Lib/test/string_tests.py index d3412d0cdc..d5ab6ae872 100644 --- a/Lib/test/string_tests.py +++ b/Lib/test/string_tests.py @@ -1130,6 +1130,10 @@ class MixinStrUnicodeUserStringTest: class X(object): pass self.checkraises(TypeError, 'abc', '__mod__', X()) + class X(Exception): + def __getitem__(self, k): + return k + self.checkequal('melon apple', '%(melon)s %(apple)s', '__mod__', X()) def test_floatformatting(self): # float formatting |