summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_format.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2012-01-21 14:50:49 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2012-01-21 14:50:49 (GMT)
commita4ac600d6f9c5b74b97b99888b7cf3a7973cadc8 (patch)
tree879a946ba599549468be6639792b3530b71db2b2 /Lib/test/test_format.py
parenta2a90717540e2853e1b9181b19585db529ae2e86 (diff)
downloadcpython-a4ac600d6f9c5b74b97b99888b7cf3a7973cadc8.zip
cpython-a4ac600d6f9c5b74b97b99888b7cf3a7973cadc8.tar.gz
cpython-a4ac600d6f9c5b74b97b99888b7cf3a7973cadc8.tar.bz2
Issue #13706: Support non-ASCII fill characters
Diffstat (limited to 'Lib/test/test_format.py')
-rw-r--r--Lib/test/test_format.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/Lib/test/test_format.py b/Lib/test/test_format.py
index 7fa950d..7345b30 100644
--- a/Lib/test/test_format.py
+++ b/Lib/test/test_format.py
@@ -263,6 +263,26 @@ class FormatTest(unittest.TestCase):
else:
raise TestFailed('"%*d"%(maxsize, -127) should fail')
+ def test_non_ascii(self):
+ self.assertEqual(format("abc", "\u2007<5"), "abc\u2007\u2007")
+ self.assertEqual(format(123, "\u2007<5"), "123\u2007\u2007")
+ self.assertEqual(format(12.3, "\u2007<6"), "12.3\u2007\u2007")
+ self.assertEqual(format(0j, "\u2007<4"), "0j\u2007\u2007")
+ self.assertEqual(format(1+2j, "\u2007<8"), "(1+2j)\u2007\u2007")
+
+ self.assertEqual(format("abc", "\u2007>5"), "\u2007\u2007abc")
+ self.assertEqual(format(123, "\u2007>5"), "\u2007\u2007123")
+ self.assertEqual(format(12.3, "\u2007>6"), "\u2007\u200712.3")
+ self.assertEqual(format(1+2j, "\u2007>8"), "\u2007\u2007(1+2j)")
+ self.assertEqual(format(0j, "\u2007>4"), "\u2007\u20070j")
+
+ self.assertEqual(format("abc", "\u2007^5"), "\u2007abc\u2007")
+ self.assertEqual(format(123, "\u2007^5"), "\u2007123\u2007")
+ self.assertEqual(format(12.3, "\u2007^6"), "\u200712.3\u2007")
+ self.assertEqual(format(1+2j, "\u2007^8"), "\u2007(1+2j)\u2007")
+ self.assertEqual(format(0j, "\u2007^4"), "\u20070j\u2007")
+
+
def test_main():
support.run_unittest(FormatTest)