summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_unicode.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2012-04-23 21:36:38 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2012-04-23 21:36:38 (GMT)
commitece58deb9fd72674b84ef7a01c944b5eed6b37a1 (patch)
tree040cbeefd99fc35b73a9a9505efb58a61177eda4 /Lib/test/test_unicode.py
parent0b7d7c95448e157d4376751add831aecbd53808e (diff)
downloadcpython-ece58deb9fd72674b84ef7a01c944b5eed6b37a1.zip
cpython-ece58deb9fd72674b84ef7a01c944b5eed6b37a1.tar.gz
cpython-ece58deb9fd72674b84ef7a01c944b5eed6b37a1.tar.bz2
Close #14648: Compute correctly maxchar in str.format() for substrin
Diffstat (limited to 'Lib/test/test_unicode.py')
-rw-r--r--Lib/test/test_unicode.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/Lib/test/test_unicode.py b/Lib/test/test_unicode.py
index 7b0397e..8468fbf 100644
--- a/Lib/test/test_unicode.py
+++ b/Lib/test/test_unicode.py
@@ -924,6 +924,14 @@ class UnicodeTest(string_tests.CommonTest,
self.assertRaises(ValueError, format, '', '#')
self.assertRaises(ValueError, format, '', '#20')
+ # Non-ASCII
+ self.assertEqual("{0:s}{1:s}".format("ABC", "\u0410\u0411\u0412"),
+ 'ABC\u0410\u0411\u0412')
+ self.assertEqual("{0:.3s}".format("ABC\u0410\u0411\u0412"),
+ 'ABC')
+ self.assertEqual("{0:.0s}".format("ABC\u0410\u0411\u0412"),
+ '')
+
def test_format_map(self):
self.assertEqual(''.format_map({}), '')
self.assertEqual('a'.format_map({}), 'a')
@@ -1056,8 +1064,6 @@ class UnicodeTest(string_tests.CommonTest,
self.assertEqual('%f' % INF, 'inf')
self.assertEqual('%F' % INF, 'INF')
- self.assertEqual(format("\u0410\u0411\u0412", "s"), "АБВ")
-
def test_startswith_endswith_errors(self):
for meth in ('foo'.startswith, 'foo'.endswith):
with self.assertRaises(TypeError) as cm: