本文整理汇总了Python中test.string_tests.MixinStrUnicodeUserStringTest方法的典型用法代码示例。如果您正苦于以下问题:Python string_tests.MixinStrUnicodeUserStringTest方法的具体用法?Python string_tests.MixinStrUnicodeUserStringTest怎么用?Python string_tests.MixinStrUnicodeUserStringTest使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test.string_tests
的用法示例。
在下文中一共展示了string_tests.MixinStrUnicodeUserStringTest方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_partition
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_partition(self):
string_tests.MixinStrUnicodeUserStringTest.test_partition(self)
# test mixed kinds
self.checkequal(('ABCDEFGH', '', ''), 'ABCDEFGH', 'partition', '\u4200')
for left, right in ('ba', '\u0101\u0100', '\U00010301\U00010300'):
left *= 9
right *= 9
for delim in ('c', '\u0102', '\U00010302'):
self.checkequal((left + right, '', ''),
left + right, 'partition', delim)
self.checkequal((left, delim, right),
left + delim + right, 'partition', delim)
self.checkequal((left + right, '', ''),
left + right, 'partition', delim * 2)
self.checkequal((left, delim * 2, right),
left + delim * 2 + right, 'partition', delim * 2)
示例2: test_rpartition
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_rpartition(self):
string_tests.MixinStrUnicodeUserStringTest.test_rpartition(self)
# test mixed kinds
self.checkequal(('', '', 'ABCDEFGH'), 'ABCDEFGH', 'rpartition', '\u4200')
for left, right in ('ba', '\u0101\u0100', '\U00010301\U00010300'):
left *= 9
right *= 9
for delim in ('c', '\u0102', '\U00010302'):
self.checkequal(('', '', left + right),
left + right, 'rpartition', delim)
self.checkequal((left, delim, right),
left + delim + right, 'rpartition', delim)
self.checkequal(('', '', left + right),
left + right, 'rpartition', delim * 2)
self.checkequal((left, delim * 2, right),
left + delim * 2 + right, 'rpartition', delim * 2)
示例3: test_join
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_join(self):
string_tests.MixinStrUnicodeUserStringTest.test_join(self)
class MyWrapper:
def __init__(self, sval): self.sval = sval
def __str__(self): return self.sval
# mixed arguments
self.checkequalnofix('a b c d', ' ', 'join', ['a', 'b', 'c', 'd'])
self.checkequalnofix('abcd', '', 'join', ('a', 'b', 'c', 'd'))
self.checkequalnofix('w x y z', ' ', 'join', string_tests.Sequence('wxyz'))
self.checkequalnofix('a b c d', ' ', 'join', ['a', 'b', 'c', 'd'])
self.checkequalnofix('a b c d', ' ', 'join', ['a', 'b', 'c', 'd'])
self.checkequalnofix('abcd', '', 'join', ('a', 'b', 'c', 'd'))
self.checkequalnofix('w x y z', ' ', 'join', string_tests.Sequence('wxyz'))
self.checkraises(TypeError, ' ', 'join', ['1', '2', MyWrapper('foo')])
self.checkraises(TypeError, ' ', 'join', ['1', '2', '3', bytes()])
self.checkraises(TypeError, ' ', 'join', [1, 2, 3])
self.checkraises(TypeError, ' ', 'join', ['1', '2', 3])
示例4: test_title
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_title(self):
string_tests.MixinStrUnicodeUserStringTest.test_title(self)
self.assertEqual('\U0001044F'.title(), '\U00010427')
self.assertEqual('\U0001044F\U0001044F'.title(),
'\U00010427\U0001044F')
self.assertEqual('\U0001044F\U0001044F \U0001044F\U0001044F'.title(),
'\U00010427\U0001044F \U00010427\U0001044F')
self.assertEqual('\U00010427\U0001044F \U00010427\U0001044F'.title(),
'\U00010427\U0001044F \U00010427\U0001044F')
self.assertEqual('\U0001044F\U00010427 \U0001044F\U00010427'.title(),
'\U00010427\U0001044F \U00010427\U0001044F')
self.assertEqual('X\U00010427x\U0001044F X\U00010427x\U0001044F'.title(),
'X\U0001044Fx\U0001044F X\U0001044Fx\U0001044F')
self.assertEqual('fiNNISH'.title(), 'Finnish')
self.assertEqual('A\u03a3 \u1fa1xy'.title(), 'A\u03c2 \u1fa9xy')
self.assertEqual('A\u03a3A'.title(), 'A\u03c3a')
示例5: test_join
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_join(self):
string_tests.MixinStrUnicodeUserStringTest.test_join(self)
# mixed arguments
self.checkequalnofix(u'a b c d', u' ', 'join', ['a', 'b', u'c', u'd'])
self.checkequalnofix(u'abcd', u'', 'join', (u'a', u'b', u'c', u'd'))
self.checkequalnofix(u'w x y z', u' ', 'join', string_tests.Sequence('wxyz'))
self.checkequalnofix(u'a b c d', ' ', 'join', [u'a', u'b', u'c', u'd'])
self.checkequalnofix(u'a b c d', ' ', 'join', ['a', 'b', u'c', u'd'])
self.checkequalnofix(u'abcd', '', 'join', (u'a', u'b', u'c', u'd'))
self.checkequalnofix(u'w x y z', ' ', 'join', string_tests.Sequence(u'wxyz'))
示例6: test_islower
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_islower(self):
string_tests.MixinStrUnicodeUserStringTest.test_islower(self)
self.checkequalnofix(False, u'\u1FFc', 'islower')
示例7: test_isupper
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_isupper(self):
string_tests.MixinStrUnicodeUserStringTest.test_isupper(self)
if not sys.platform.startswith('java'):
self.checkequalnofix(False, u'\u1FFc', 'isupper')
示例8: test_istitle
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_istitle(self):
string_tests.MixinStrUnicodeUserStringTest.test_istitle(self)
self.checkequalnofix(True, u'\u1FFc', 'istitle')
self.checkequalnofix(True, u'Greek \u1FFcitlecases ...', 'istitle')
示例9: test_isspace
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_isspace(self):
string_tests.MixinStrUnicodeUserStringTest.test_isspace(self)
self.checkequalnofix(True, u'\u2000', 'isspace')
self.checkequalnofix(True, u'\u200a', 'isspace')
self.checkequalnofix(False, u'\u2014', 'isspace')
示例10: test_isdigit
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_isdigit(self):
string_tests.MixinStrUnicodeUserStringTest.test_isdigit(self)
self.checkequalnofix(True, u'\u2460', 'isdigit')
self.checkequalnofix(False, u'\xbc', 'isdigit')
self.checkequalnofix(True, u'\u0660', 'isdigit')
示例11: test_title
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_title(self):
string_tests.MixinStrUnicodeUserStringTest.test_title(self)
self.assertEqual(u'\U0001044F'.title(), u'\U00010427')
self.assertEqual(u'\U0001044F\U0001044F'.title(),
u'\U00010427\U0001044F')
self.assertEqual(u'\U0001044F\U0001044F \U0001044F\U0001044F'.title(),
u'\U00010427\U0001044F \U00010427\U0001044F')
self.assertEqual(u'\U00010427\U0001044F \U00010427\U0001044F'.title(),
u'\U00010427\U0001044F \U00010427\U0001044F')
self.assertEqual(u'\U0001044F\U00010427 \U0001044F\U00010427'.title(),
u'\U00010427\U0001044F \U00010427\U0001044F')
self.assertEqual(u'X\U00010427x\U0001044F X\U00010427x\U0001044F'.title(),
u'X\U0001044Fx\U0001044F X\U0001044Fx\U0001044F')
示例12: test_formatting
# 需要导入模块: from test import string_tests [as 别名]
# 或者: from test.string_tests import MixinStrUnicodeUserStringTest [as 别名]
def test_formatting(self):
string_tests.MixinStrUnicodeUserStringTest.test_formatting(self)
self.assertRaises(OverflowError, '%c'.__mod__, 0x1234)