diff options
author | R. David Murray <rdmurray@bitdance.com> | 2009-12-14 16:28:26 (GMT) |
---|---|---|
committer | R. David Murray <rdmurray@bitdance.com> | 2009-12-14 16:28:26 (GMT) |
commit | 0a0a1a842c02c87fcb052dec226f591cfe6f988f (patch) | |
tree | 9b656f294913ab834fed62433fbc0b4dadcb42c7 /Lib | |
parent | 96228739c5a66cb7c5ab82e1e1d179b642e405cb (diff) | |
download | cpython-0a0a1a842c02c87fcb052dec226f591cfe6f988f.zip cpython-0a0a1a842c02c87fcb052dec226f591cfe6f988f.tar.gz cpython-0a0a1a842c02c87fcb052dec226f591cfe6f988f.tar.bz2 |
Issue #1680159: unicode coercion during an 'in' operation was masking
any errors that might occur during coercion of the left operand and
turning them into a TypeError with a message text that was confusing in
the given context. This patch lets any errors through, as was already
done during coercion of the right hand side.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_unicode.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py index 2b269cc..31bceb3 100644 --- a/Lib/test/test_unicode.py +++ b/Lib/test/test_unicode.py @@ -344,7 +344,8 @@ class UnicodeTest( # If the following fails either # the contains operator does not propagate UnicodeErrors or # someone has changed the default encoding - self.assertRaises(UnicodeError, 'g\xe2teau'.__contains__, u'\xe2') + self.assertRaises(UnicodeDecodeError, 'g\xe2teau'.__contains__, u'\xe2') + self.assertRaises(UnicodeDecodeError, u'g\xe2teau'.__contains__, '\xe2') self.assertTrue(u'' in '') self.assertTrue('' in u'') @@ -375,6 +376,7 @@ class UnicodeTest( self.assertTrue(u'asdf' not in u'') self.assertRaises(TypeError, u"abc".__contains__) + self.assertRaises(TypeError, u"abc".__contains__, object()) def test_formatting(self): string_tests.MixinStrUnicodeUserStringTest.test_formatting(self) |