summaryrefslogtreecommitdiff
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorEzio Melotti <none@none>2011-04-26 05:12:51 +0300
committerEzio Melotti <none@none>2011-04-26 05:12:51 +0300
commite3685f6b1b27bf089a40a12492f952dda5ff3ea2 (patch)
treec203d4df92443193797fd04fe93508711c280b92 /Lib/test/test_unicode.py
parenta0895db2e1e94a7a2dfba4f75475975720aae224 (diff)
downloadcpython-git-e3685f6b1b27bf089a40a12492f952dda5ff3ea2.tar.gz
#6780: fix starts/endswith error message to mention that tuples are accepted too.
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index ae4c355f48..bd43dbc57b 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -442,6 +442,17 @@ class UnicodeTest(
return u'\u1234'
self.assertEqual('%s' % Wrapper(), u'\u1234')
+ def test_startswith_endswith_errors(self):
+ for meth in (u'foo'.startswith, u'foo'.endswith):
+ with self.assertRaises(UnicodeDecodeError):
+ meth('\xff')
+ with self.assertRaises(TypeError) as cm:
+ meth(['f'])
+ exc = str(cm.exception)
+ self.assertIn('unicode', exc)
+ self.assertIn('str', exc)
+ self.assertIn('tuple', exc)
+
@test_support.run_with_locale('LC_ALL', 'de_DE', 'fr_FR')
def test_format_float(self):
# should not format with a comma, but always with C locale