Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f84e01d

Browse files
committed
Add a couple of tests for str.center with non-ASCII chars.
1 parent b08495b commit f84e01d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

Lib/test/test_unicode.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -652,6 +652,15 @@ def test_swapcase(self):
652652
self.assertEqual('ß'.swapcase(), 'SS')
653653
self.assertEqual('\u1fd2'.swapcase(), '\u0399\u0308\u0300')
654654

655+
def test_center(self):
656+
string_tests.CommonTest.test_center(self)
657+
self.assertEqual('x'.center(2, '\U0010FFFF'),
658+
'x\U0010FFFF')
659+
self.assertEqual('x'.center(3, '\U0010FFFF'),
660+
'\U0010FFFFx\U0010FFFF')
661+
self.assertEqual('x'.center(4, '\U0010FFFF'),
662+
'\U0010FFFFx\U0010FFFF\U0010FFFF')
663+
655664
def test_contains(self):
656665
# Testing Unicode contains method
657666
self.assertIn('a', 'abdb')

0 commit comments

Comments
 (0)