Lines Matching refs:assertEqual
62 self.assertEqual(realresult, result)
74 self.assertEqual(realresult, result)
78 self.assertEqual('\xff', '\u00ff')
79 self.assertEqual('\uffff', '\U0000ffff')
89 self.assertEqual(ascii('abc'), "'abc'")
90 self.assertEqual(ascii('ab\\c'), "'ab\\\\c'")
91 self.assertEqual(ascii('ab\\'), "'ab\\\\'")
92 self.assertEqual(ascii('\\c'), "'\\\\c'")
93 self.assertEqual(ascii('\\'), "'\\\\'")
94 self.assertEqual(ascii('\n'), "'\\n'")
95 self.assertEqual(ascii('\r'), "'\\r'")
96 self.assertEqual(ascii('\t'), "'\\t'")
97 self.assertEqual(ascii('\b'), "'\\x08'")
98 self.assertEqual(ascii("'\""), """'\\'"'""")
99 self.assertEqual(ascii("'\""), """'\\'"'""")
100 self.assertEqual(ascii("'"), '''"'"''')
101 self.assertEqual(ascii('"'), """'"'""")
118 self.assertEqual(testrepr, latin1repr)
120 self.assertEqual(ascii("\U00010000" * 39 + "\uffff" * 4096),
131 self.assertEqual(repr('abc'), "'abc'")
132 self.assertEqual(repr('ab\\c'), "'ab\\\\c'")
133 self.assertEqual(repr('ab\\'), "'ab\\\\'")
134 self.assertEqual(repr('\\c'), "'\\\\c'")
135 self.assertEqual(repr('\\'), "'\\\\'")
136 self.assertEqual(repr('\n'), "'\\n'")
137 self.assertEqual(repr('\r'), "'\\r'")
138 self.assertEqual(repr('\t'), "'\\t'")
139 self.assertEqual(repr('\b'), "'\\x08'")
140 self.assertEqual(repr("'\""), """'\\'"'""")
141 self.assertEqual(repr("'\""), """'\\'"'""")
142 self.assertEqual(repr("'"), '''"'"''')
143 self.assertEqual(repr('"'), """'"'""")
160 self.assertEqual(testrepr, latin1repr)
162 self.assertEqual(repr("\U00010000" * 39 + "\uffff" * 4096),
173 self.assertEqual(next(it), "\u1111")
174 self.assertEqual(next(it), "\u2222")
175 self.assertEqual(next(it), "\u3333")
337 self.assertEqual("[a]".translate(str.maketrans('a', 'X')),
339 self.assertEqual("[a]".translate(str.maketrans({'a': 'X'})),
341 self.assertEqual("[a]".translate(str.maketrans({'a': None})),
343 self.assertEqual("[a]".translate(str.maketrans({'a': 'XXX'})),
345 self.assertEqual("[a]".translate(str.maketrans({'a': '\xe9'})),
347 self.assertEqual('axb'.translate(str.maketrans({'a': None, 'b': '123'})),
349 self.assertEqual('axb'.translate(str.maketrans({'a': None, 'b': '\xe9'})),
353 self.assertEqual("[a]".translate(str.maketrans({'a': '<\xe9>'})),
355 self.assertEqual("[\xe9]".translate(str.maketrans({'\xe9': 'a'})),
357 self.assertEqual("[\xe9]".translate(str.maketrans({'\xe9': None})),
359 self.assertEqual("[\xe9]".translate(str.maketrans({'\xe9': '123'})),
361 self.assertEqual("[a\xe9]".translate(str.maketrans({'a': '<\u20ac>'})),
509 self.assertEqual('abc' == b'abc', False)
510 self.assertEqual('abc' != b'abc', True)
511 self.assertEqual('abc' == bytearray(b'abc'), False)
512 self.assertEqual('abc' != bytearray(b'abc'), True)
516 self.assertEqual('abc', 'abc')
632 self.assertEqual(char.isspace(),
774 self.assertEqual('\U00010427'.lower(), '\U0001044F')
775 self.assertEqual('\U00010427\U00010427'.lower(),
777 self.assertEqual('\U00010427\U0001044F'.lower(),
779 self.assertEqual('X\U00010427x\U0001044F'.lower(),
781 self.assertEqual('fi'.lower(), 'fi')
782 self.assertEqual('\u0130'.lower(), '\u0069\u0307')
784 self.assertEqual('\u03a3'.lower(), '\u03c3')
785 self.assertEqual('\u0345\u03a3'.lower(), '\u0345\u03c3')
786 self.assertEqual('A\u0345\u03a3'.lower(), 'a\u0345\u03c2')
787 self.assertEqual('A\u0345\u03a3a'.lower(), 'a\u0345\u03c3a')
788 self.assertEqual('A\u0345\u03a3'.lower(), 'a\u0345\u03c2')
789 self.assertEqual('A\u03a3\u0345'.lower(), 'a\u03c2\u0345')
790 self.assertEqual('\u03a3\u0345 '.lower(), '\u03c3\u0345 ')
791 self.assertEqual('\U0008fffe'.lower(), '\U0008fffe')
792 self.assertEqual('\u2177'.lower(), '\u2177')
795 self.assertEqual('hello'.casefold(), 'hello')
796 self.assertEqual('hELlo'.casefold(), 'hello')
797 self.assertEqual('ß'.casefold(), 'ss')
798 self.assertEqual('fi'.casefold(), 'fi')
799 self.assertEqual('\u03a3'.casefold(), '\u03c3')
800 self.assertEqual('A\u0345\u03a3'.casefold(), 'a\u03b9\u03c3')
801 self.assertEqual('\u00b5'.casefold(), '\u03bc')
805 self.assertEqual('\U0001044F'.upper(), '\U00010427')
806 self.assertEqual('\U0001044F\U0001044F'.upper(),
808 self.assertEqual('\U00010427\U0001044F'.upper(),
810 self.assertEqual('X\U00010427x\U0001044F'.upper(),
812 self.assertEqual('fi'.upper(), 'FI')
813 self.assertEqual('\u0130'.upper(), '\u0130')
814 self.assertEqual('\u03a3'.upper(), '\u03a3')
815 self.assertEqual('ß'.upper(), 'SS')
816 self.assertEqual('\u1fd2'.upper(), '\u0399\u0308\u0300')
817 self.assertEqual('\U0008fffe'.upper(), '\U0008fffe')
818 self.assertEqual('\u2177'.upper(), '\u2167')
822 self.assertEqual('\U0001044F'.capitalize(), '\U00010427')
823 self.assertEqual('\U0001044F\U0001044F'.capitalize(),
825 self.assertEqual('\U00010427\U0001044F'.capitalize(),
827 self.assertEqual('\U0001044F\U00010427'.capitalize(),
829 self.assertEqual('X\U00010427x\U0001044F'.capitalize(),
831 self.assertEqual('h\u0130'.capitalize(), 'H\u0069\u0307')
833 self.assertEqual('\u1fd2\u0130'.capitalize(), exp)
834 self.assertEqual('finnish'.capitalize(), 'Finnish')
835 self.assertEqual('A\u0345\u03a3'.capitalize(), 'A\u0345\u03c2')
839 self.assertEqual('\U0001044F'.title(), '\U00010427')
840 self.assertEqual('\U0001044F\U0001044F'.title(),
842 self.assertEqual('\U0001044F\U0001044F \U0001044F\U0001044F'.title(),
844 self.assertEqual('\U00010427\U0001044F \U00010427\U0001044F'.title(),
846 self.assertEqual('\U0001044F\U00010427 \U0001044F\U00010427'.title(),
848 self.assertEqual('X\U00010427x\U0001044F X\U00010427x\U0001044F'.title(),
850 self.assertEqual('fiNNISH'.title(), 'Finnish')
851 self.assertEqual('A\u03a3 \u1fa1xy'.title(), 'A\u03c2 \u1fa9xy')
852 self.assertEqual('A\u03a3A'.title(), 'A\u03c3a')
856 self.assertEqual('\U0001044F'.swapcase(), '\U00010427')
857 self.assertEqual('\U00010427'.swapcase(), '\U0001044F')
858 self.assertEqual('\U0001044F\U0001044F'.swapcase(),
860 self.assertEqual('\U00010427\U0001044F'.swapcase(),
862 self.assertEqual('\U0001044F\U00010427'.swapcase(),
864 self.assertEqual('X\U00010427x\U0001044F'.swapcase(),
866 self.assertEqual('fi'.swapcase(), 'FI')
867 self.assertEqual('\u0130'.swapcase(), '\u0069\u0307')
869 self.assertEqual('\u03a3'.swapcase(), '\u03c3')
870 self.assertEqual('\u0345\u03a3'.swapcase(), '\u0399\u03c3')
871 self.assertEqual('A\u0345\u03a3'.swapcase(), 'a\u0399\u03c2')
872 self.assertEqual('A\u0345\u03a3a'.swapcase(), 'a\u0399\u03c3A')
873 self.assertEqual('A\u0345\u03a3'.swapcase(), 'a\u0399\u03c2')
874 self.assertEqual('A\u03a3\u0345'.swapcase(), 'a\u03c2\u0399')
875 self.assertEqual('\u03a3\u0345 '.swapcase(), '\u03c3\u0399 ')
876 self.assertEqual('\u03a3'.swapcase(), '\u03c3')
877 self.assertEqual('ß'.swapcase(), 'SS')
878 self.assertEqual('\u1fd2'.swapcase(), '\u0399\u0308\u0300')
882 self.assertEqual('x'.center(2, '\U0010FFFF'),
884 self.assertEqual('x'.center(3, '\U0010FFFF'),
886 self.assertEqual('x'.center(4, '\U0010FFFF'),
954 self.assertEqual(''.format(), '')
955 self.assertEqual('a'.format(), 'a')
956 self.assertEqual('ab'.format(), 'ab')
957 self.assertEqual('a{{'.format(), 'a{')
958 self.assertEqual('a}}'.format(), 'a}')
959 self.assertEqual('{{b'.format(), '{b')
960 self.assertEqual('}}b'.format(), '}b')
961 self.assertEqual('a{{b'.format(), 'a{b')
965 self.assertEqual("My name is {0}".format('Fred'), "My name is Fred")
966 self.assertEqual("My name is {0[name]}".format(dict(name='Fred')),
968 self.assertEqual("My name is {0} :-{{}}".format('Fred'),
972 self.assertEqual("The year is {0.year}".format(d),
1035 self.assertEqual(''.format(), '')
1036 self.assertEqual('abc'.format(), 'abc')
1037 self.assertEqual('{0}'.format('abc'), 'abc')
1038 self.assertEqual('{0:}'.format('abc'), 'abc')
1040 self.assertEqual('X{0}'.format('abc'), 'Xabc')
1041 self.assertEqual('{0}X'.format('abc'), 'abcX')
1042 self.assertEqual('X{0}Y'.format('abc'), 'XabcY')
1043 self.assertEqual('{1}'.format(1, 'abc'), 'abc')
1044 self.assertEqual('X{1}'.format(1, 'abc'), 'Xabc')
1045 self.assertEqual('{1}X'.format(1, 'abc'), 'abcX')
1046 self.assertEqual('X{1}Y'.format(1, 'abc'), 'XabcY')
1047 self.assertEqual('{0}'.format(-15), '-15')
1048 self.assertEqual('{0}{1}'.format(-15, 'abc'), '-15abc')
1049 self.assertEqual('{0}X{1}'.format(-15, 'abc'), '-15Xabc')
1050 self.assertEqual('{{'.format(), '{')
1051 self.assertEqual('}}'.format(), '}')
1052 self.assertEqual('{{}}'.format(), '{}')
1053 self.assertEqual('{{x}}'.format(), '{x}')
1054 self.assertEqual('{{{0}}}'.format(123), '{123}')
1055 self.assertEqual('{{{{0}}}}'.format(), '{{0}}')
1056 self.assertEqual('}}{{'.format(), '}{')
1057 self.assertEqual('}}x{{'.format(), '}x{')
1060 self.assertEqual("{0[foo-bar]}".format({'foo-bar':'baz'}), 'baz')
1061 self.assertEqual("{0[foo bar]}".format({'foo bar':'baz'}), 'baz')
1062 self.assertEqual("{0[ ]}".format({' ':3}), '3')
1064 self.assertEqual('{foo._x}'.format(foo=C(20)), '20')
1065 self.assertEqual('{1}{0}'.format(D(10), D(20)), '2010')
1066 self.assertEqual('{0._x.x}'.format(C(D('abc'))), 'abc')
1067 self.assertEqual('{0[0]}'.format(['abc', 'def']), 'abc')
1068 self.assertEqual('{0[1]}'.format(['abc', 'def']), 'def')
1069 self.assertEqual('{0[1][0]}'.format(['abc', ['def']]), 'def')
1070 self.assertEqual('{0[1][0].x}'.format(['abc', [D('def')]]), 'def')
1073 self.assertEqual('{0:.3s}'.format('abc'), 'abc')
1074 self.assertEqual('{0:.3s}'.format('ab'), 'ab')
1075 self.assertEqual('{0:.3s}'.format('abcdef'), 'abc')
1076 self.assertEqual('{0:.0s}'.format('abcdef'), '')
1077 self.assertEqual('{0:3.3s}'.format('abc'), 'abc')
1078 self.assertEqual('{0:2.3s}'.format('abc'), 'abc')
1079 self.assertEqual('{0:2.2s}'.format('abc'), 'ab')
1080 self.assertEqual('{0:3.2s}'.format('abc'), 'ab ')
1081 self.assertEqual('{0:x<0s}'.format('result'), 'result')
1082 self.assertEqual('{0:x<5s}'.format('result'), 'result')
1083 self.assertEqual('{0:x<6s}'.format('result'), 'result')
1084 self.assertEqual('{0:x<7s}'.format('result'), 'resultx')
1085 self.assertEqual('{0:x<8s}'.format('result'), 'resultxx')
1086 self.assertEqual('{0: <7s}'.format('result'), 'result ')
1087 self.assertEqual('{0:<7s}'.format('result'), 'result ')
1088 self.assertEqual('{0:>7s}'.format('result'), ' result')
1089 self.assertEqual('{0:>8s}'.format('result'), ' result')
1090 self.assertEqual('{0:^8s}'.format('result'), ' result ')
1091 self.assertEqual('{0:^9s}'.format('result'), ' result ')
1092 self.assertEqual('{0:^10s}'.format('result'), ' result ')
1093 self.assertEqual('{0:10000}'.format('a'), 'a' + ' ' * 9999)
1094 self.assertEqual('{0:10000}'.format(''), ' ' * 10000)
1095 self.assertEqual('{0:10000000}'.format(''), ' ' * 10000000)
1098 self.assertEqual('{0:\x00<6s}'.format('foo'), 'foo\x00\x00\x00')
1099 self.assertEqual('{0:\x01<6s}'.format('foo'), 'foo\x01\x01\x01')
1100 self.assertEqual('{0:\x00^6s}'.format('foo'), '\x00foo\x00\x00')
1101 self.assertEqual('{0:^6s}'.format('foo'), ' foo ')
1103 self.assertEqual('{0:\x00<6}'.format(3), '3\x00\x00\x00\x00\x00')
1104 self.assertEqual('{0:\x01<6}'.format(3), '3\x01\x01\x01\x01\x01')
1105 self.assertEqual('{0:\x00^6}'.format(3), '\x00\x003\x00\x00\x00')
1106 self.assertEqual('{0:<6}'.format(3), '3 ')
1108 self.assertEqual('{0:\x00<6}'.format(3.14), '3.14\x00\x00')
1109 self.assertEqual('{0:\x01<6}'.format(3.14), '3.14\x01\x01')
1110 self.assertEqual('{0:\x00^6}'.format(3.14), '\x003.14\x00')
1111 self.assertEqual('{0:^6}'.format(3.14), ' 3.14 ')
1113 self.assertEqual('{0:\x00<12}'.format(3+2.0j), '(3+2j)\x00\x00\x00\x00\x00\x00')
1114 self.assertEqual('{0:\x01<12}'.format(3+2.0j), '(3+2j)\x01\x01\x01\x01\x01\x01')
1115 self.assertEqual('{0:\x00^12}'.format(3+2.0j), '\x00\x00\x00(3+2j)\x00\x00\x00')
1116 self.assertEqual('{0:^12}'.format(3+2.0j), ' (3+2j) ')
1119 self.assertEqual('{0:abc}'.format(C()), 'abc')
1122 self.assertEqual('{0!s}'.format('Hello'), 'Hello')
1123 self.assertEqual('{0!s:}'.format('Hello'), 'Hello')
1124 self.assertEqual('{0!s:15}'.format('Hello'), 'Hello ')
1125 self.assertEqual('{0!s:15s}'.format('Hello'), 'Hello ')
1126 self.assertEqual('{0!r}'.format('Hello'), "'Hello'")
1127 self.assertEqual('{0!r:}'.format('Hello'), "'Hello'")
1128 self.assertEqual('{0!r}'.format(F('Hello')), 'F(Hello)')
1129 self.assertEqual('{0!r}'.format('\u0378'), "'\\u0378'") # nonprintable
1130 self.assertEqual('{0!r}'.format('\u0374'), "'\u0374'") # printable
1131 self.assertEqual('{0!r}'.format(F('\u0374')), 'F(\u0374)')
1132 self.assertEqual('{0!a}'.format('Hello'), "'Hello'")
1133 self.assertEqual('{0!a}'.format('\u0378'), "'\\u0378'") # nonprintable
1134 self.assertEqual('{0!a}'.format('\u0374'), "'\\u0374'") # printable
1135 self.assertEqual('{0!a:}'.format('Hello'), "'Hello'")
1136 self.assertEqual('{0!a}'.format(F('Hello')), 'F(Hello)')
1137 self.assertEqual('{0!a}'.format(F('\u0374')), 'F(\\u0374)')
1140 self.assertEqual('{0}'.format({}), '{}')
1141 self.assertEqual('{0}'.format([]), '[]')
1142 self.assertEqual('{0}'.format([1]), '[1]')
1144 self.assertEqual('{0:d}'.format(G('data')), 'G(data)')
1145 self.assertEqual('{0!s}'.format(G('data')), 'string is data')
1151 self.assertEqual("{0:date: %Y-%m-%d}".format(I(year=2007,
1157 self.assertEqual("{0}".format(J(10)), "20")
1161 self.assertEqual('{0:}'.format('a'), 'a')
1164 self.assertEqual("{0:.{1}}".format('hello world', 5), 'hello')
1165 self.assertEqual("{0:.{1}s}".format('hello world', 5), 'hello')
1166 self.assertEqual("{0:.{precision}s}".format('hello world', precision=5), 'hello')
1167 …self.assertEqual("{0:{width}.{precision}s}".format('hello world', width=10, precision=5), 'hello …
1168 …self.assertEqual("{0:{width}.{precision}s}".format('hello world', width='10', precision='5'), 'hel…
1229 self.assertEqual("{0:s}{1:s}".format("ABC", "\u0410\u0411\u0412"),
1231 self.assertEqual("{0:.3s}".format("ABC\u0410\u0411\u0412"),
1233 self.assertEqual("{0:.0s}".format("ABC\u0410\u0411\u0412"),
1236 self.assertEqual("{[{}]}".format({"{}": 5}), "5")
1237 self.assertEqual("{[{}]}".format({"{}" : "a"}), "a")
1238 self.assertEqual("{[{]}".format({"{" : "a"}), "a")
1239 self.assertEqual("{[}]}".format({"}" : "a"}), "a")
1240 self.assertEqual("{[[]}".format({"[" : "a"}), "a")
1241 self.assertEqual("{[!]}".format({"!" : "a"}), "a")
1246 self.assertEqual("0x{:0{:d}X}".format(0x0,16), "0x0000000000000000")
1250 self.assertEqual("{!r}".format(m), 'M(data)')
1254 self.assertEqual("{!r}".format(n), 'N(data)')
1255 self.assertEqual("{!s}".format(n), 'N(data)')
1259 self.assertEqual(''.format_map({}), '')
1260 self.assertEqual('a'.format_map({}), 'a')
1261 self.assertEqual('ab'.format_map({}), 'ab')
1262 self.assertEqual('a{{'.format_map({}), 'a{')
1263 self.assertEqual('a}}'.format_map({}), 'a}')
1264 self.assertEqual('{{b'.format_map({}), '{b')
1265 self.assertEqual('}}b'.format_map({}), '}b')
1266 self.assertEqual('a{{b'.format_map({}), 'a{b')
1272 self.assertEqual('{hello}'.format_map(Mapping()), 'hello')
1273 self.assertEqual('{a} {world}'.format_map(Mapping(a='hello')), 'hello world')
1280 self.assertEqual('{a}'.format_map(InternalMapping()), 'hello')
1288 self.assertEqual('{foo._x}'.format_map({'foo': C(20)}), '20')
1335 self.assertEqual('{}'.format(10), '10')
1336 self.assertEqual('{:5}'.format('s'), 's ')
1337 self.assertEqual('{!r}'.format('s'), "'s'")
1338 self.assertEqual('{._x}'.format(C(10)), '10')
1339 self.assertEqual('{[1]}'.format([1, 2]), '2')
1340 self.assertEqual('{[a]}'.format({'a':4, 'b':2}), '4')
1341 self.assertEqual('a{}b{}c'.format(0, 1), 'a0b1c')
1343 self.assertEqual('a{:{}}b'.format('x', '^10'), 'a x b')
1344 self.assertEqual('a{:{}x}b'.format(20, '#'), 'a0x14b')
1353 self.assertEqual('{f}{}'.format(4, f='test'), 'test4')
1354 self.assertEqual('{}{f}'.format(4, f='test'), '4test')
1355 self.assertEqual('{:{f}}{g}{}'.format(1, 3, g='g', f=2), ' 1g3')
1356 self.assertEqual('{f:{}}{}{g}'.format(2, 4, f=1, g='g'), ' 14g')
1361 self.assertEqual("%s, %s" % ("abc", "abc"), 'abc, abc')
1362 …self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", 1, 2, 3), 'abc, abc, 1, 2.000000, 3.00')
1363 …self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", 1, -2, 3), 'abc, abc, 1, -2.000000, 3.0…
1364 …self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 3.5), 'abc, abc, -1, -2.000000, …
1365 …self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 3.57), 'abc, abc, -1, -2.000000,…
1366 …self.assertEqual("%s, %s, %i, %f, %5.2f" % ("abc", "abc", -1, -2, 1003.57), 'abc, abc, -1, -2.0000…
1368 self.assertEqual("%r, %r" % (b"abc", "abc"), "b'abc', 'abc'")
1369 self.assertEqual("%r" % ("\u1234",), "'\u1234'")
1370 self.assertEqual("%a" % ("\u1234",), "'\\u1234'")
1371 self.assertEqual("%(x)s, %(y)s" % {'x':"abc", 'y':"def"}, 'abc, def')
1372 self.assertEqual("%(x)s, %(\xfc)s" % {'x':"abc", '\xfc':"def"}, 'abc, def')
1374 self.assertEqual('%c' % 0x1234, '\u1234')
1375 self.assertEqual('%c' % 0x21483, '\U00021483')
1377 self.assertEqual('%c' % '\U00021483', '\U00021483')
1383 self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...')
1384 self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...')
1385 self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...')
1386 self.assertEqual('...%(foo)s...' % {'foo':"abc"}, '...abc...')
1387 self.assertEqual('...%(foo)s...' % {'foo':"abc",'def':123}, '...abc...')
1388 self.assertEqual('...%(foo)s...' % {'foo':"abc",'def':123}, '...abc...')
1389 self.assertEqual('...%s...%s...%s...%s...' % (1,2,3,"abc"), '...1...2...3...abc...')
1390 …self.assertEqual('...%%...%%s...%s...%s...%s...%s...' % (1,2,3,"abc"), '...%...%s...1...2...3...ab…
1391 self.assertEqual('...%s...' % "abc", '...abc...')
1392 self.assertEqual('%*s' % (5,'abc',), ' abc')
1393 self.assertEqual('%*s' % (-5,'abc',), 'abc ')
1394 self.assertEqual('%*.*s' % (5,2,'abc',), ' ab')
1395 self.assertEqual('%*.*s' % (5,3,'abc',), ' abc')
1396 self.assertEqual('%i %*.*s' % (10, 5,3,'abc',), '10 abc')
1397 self.assertEqual('%i%s %*.*s' % (10, 3, 5, 3, 'abc',), '103 abc')
1398 self.assertEqual('%c' % 'a', 'a')
1402 self.assertEqual('%s' % Wrapper(), '\u1234')
1407 self.assertEqual('%f' % NAN, 'nan')
1408 self.assertEqual('%F' % NAN, 'NAN')
1409 self.assertEqual('%f' % INF, 'inf')
1410 self.assertEqual('%F' % INF, 'INF')
1413 self.assertEqual('%.1s' % "a\xe9\u20ac", 'a')
1414 self.assertEqual('%.2s' % "a\xe9\u20ac", 'a\xe9')
1431 self.assertEqual('%x' % 42, '2a')
1432 self.assertEqual('%X' % 15, 'F')
1433 self.assertEqual('%o' % 9, '11')
1434 self.assertEqual('%c' % 109, 'm')
1435 self.assertEqual('%x' % letter_m, '6d')
1436 self.assertEqual('%X' % letter_m, '6D')
1437 self.assertEqual('%o' % letter_m, '155')
1438 self.assertEqual('%c' % letter_m, 'm')
1455 self.assertEqual("%s, %s" % (Str.ABC, Str.ABC),
1457 self.assertEqual("%s, %s, %d, %i, %u, %f, %5.2f" %
1464 self.assertEqual('...%(foo)s...' % {'foo':Str.ABC},
1466 self.assertEqual('...%(foo)s...' % {'foo':Int.IDES},
1468 self.assertEqual('...%(foo)i...' % {'foo':Int.IDES},
1470 self.assertEqual('...%(foo)d...' % {'foo':Int.IDES},
1472 self.assertEqual('...%(foo)u...' % {'foo':Int.IDES, 'def':Float.PI},
1474 self.assertEqual('...%(foo)f...' % {'foo':Float.PI,'def':123},
1488 self.assertEqual('lhs %% %r' % SubclassedStr('rhs'),
1514 self.assertEqual('1.0', '%.1f' % 1.0)
1519 self.assertEqual(
1526 self.assertEqual(str(subclass), text)
1527 self.assertEqual(len(subclass), len(text))
1529 self.assertEqual(subclass.encode('ascii'), b'ascii')
1530 self.assertEqual(subclass.encode('utf-8'), b'ascii')
1532 self.assertEqual(
1543 self.assertEqual(
1551 self.assertEqual(str(o), 'unicode(obj) is compatible to str()')
1552 self.assertEqual(str(o), 'unicode(obj) is compatible to str()')
1555 self.assertEqual(str(obj), str(str(obj)))
1569 self.assertEqual(
1575 self.assertEqual(
1589 self.assertEqual(str(object='foo'), 'foo')
1590 self.assertEqual(str(object=b'foo', encoding='utf-8'), 'foo')
1592 self.assertEqual(str(b'foo', errors='strict'), 'foo') # not "b'foo'"
1593 self.assertEqual(str(object=b'foo', errors='strict'), 'foo')
1598 self.assertEqual(str(), '')
1599 self.assertEqual(str(errors='strict'), '')
1602 self.assertEqual(str(utf8_cent, errors='strict'), '¢')
1625 self.assertEqual(x.encode('utf-7'), y)
1628 self.assertEqual('\uD801'.encode('utf-7'), b'+2AE-')
1629 self.assertEqual('\uD801x'.encode('utf-7'), b'+2AE-x')
1630 self.assertEqual('\uDC01'.encode('utf-7'), b'+3AE-')
1631 self.assertEqual('\uDC01x'.encode('utf-7'), b'+3AE-x')
1632 self.assertEqual(b'+2AE-'.decode('utf-7'), '\uD801')
1633 self.assertEqual(b'+2AE-x'.decode('utf-7'), '\uD801x')
1634 self.assertEqual(b'+3AE-'.decode('utf-7'), '\uDC01')
1635 self.assertEqual(b'+3AE-x'.decode('utf-7'), '\uDC01x')
1637 self.assertEqual('\uD801\U000abcde'.encode('utf-7'), b'+2AHab9ze-')
1638 self.assertEqual(b'+2AHab9ze-'.decode('utf-7'), '\uD801\U000abcde')
1641 self.assertEqual(b'+\xc1'.decode('utf-7', 'ignore'), '')
1648 self.assertEqual(c.encode('utf7'), c.encode('ascii'))
1649 self.assertEqual(c.encode('ascii').decode('utf7'), c)
1651 self.assertEqual(c.encode('ascii').decode('utf7'), c)
1658 self.assertEqual(''.encode('utf-8'), b'')
1659 self.assertEqual('\u20ac'.encode('utf-8'), b'\xe2\x82\xac')
1660 self.assertEqual('\U00010002'.encode('utf-8'), b'\xf0\x90\x80\x82')
1661 self.assertEqual('\U00023456'.encode('utf-8'), b'\xf0\xa3\x91\x96')
1662 self.assertEqual('\ud800'.encode('utf-8', 'surrogatepass'), b'\xed\xa0\x80')
1663 self.assertEqual('\udc00'.encode('utf-8', 'surrogatepass'), b'\xed\xb0\x80')
1664 self.assertEqual(('\U00010002'*10).encode('utf-8'),
1666 self.assertEqual(
1686 self.assertEqual(str(b'\xf0\xa3\x91\x96', 'utf-8'), '\U00023456' )
1687 self.assertEqual(str(b'\xf0\x90\x80\x82', 'utf-8'), '\U00010002' )
1688 self.assertEqual(str(b'\xe2\x82\xac', 'utf-8'), '\u20ac' )
1708 self.assertEqual(seq.decode('utf-8'), res)
1842 self.assertEqual(seq.decode('utf-8', 'replace'), res)
1843 self.assertEqual((seq+b'b').decode('utf-8', 'replace'), res+'b')
1844 self.assertEqual(seq.decode('utf-8', 'ignore'),
1858 self.assertEqual(seq.decode('utf-8', 'replace'), res)
1859 self.assertEqual((b'aaaa' + seq + b'bbbb').decode('utf-8', 'replace'),
1862 self.assertEqual(seq.decode('utf-8', 'ignore'), res)
1863 self.assertEqual((b'aaaa' + seq + b'bbbb').decode('utf-8', 'ignore'),
2066 self.assertEqual("www.python.org.".encode("idna"), b"www.python.org.")
2072 self.assertEqual('Andr\202 x'.encode('ascii','ignore'), b"Andr x")
2073 self.assertEqual('Andr\202 x'.encode('ascii','replace'), b"Andr? x")
2074 self.assertEqual('Andr\202 x'.encode('ascii', 'replace'),
2076 self.assertEqual('Andr\202 x'.encode('ascii', 'ignore'),
2082 self.assertEqual(str(b'Andr\202 x', 'ascii', 'ignore'), "Andr x")
2083 self.assertEqual(str(b'Andr\202 x', 'ascii', 'replace'), 'Andr\uFFFD x')
2084 self.assertEqual(str(b'\202 x', 'ascii', 'replace'), '\uFFFD x')
2087 self.assertEqual(b"\\N{foo}xx".decode("unicode-escape", "ignore"), "xx")
2111 self.assertEqual('hello'.encode('ascii'), b'hello')
2112 self.assertEqual('hello'.encode('utf-7'), b'hello')
2113 self.assertEqual('hello'.encode('utf-8'), b'hello')
2114 self.assertEqual('hello'.encode('utf-8'), b'hello')
2115 self.assertEqual('hello'.encode('utf-16-le'), b'h\000e\000l\000l\000o\000')
2116 self.assertEqual('hello'.encode('utf-16-be'), b'\000h\000e\000l\000l\000o')
2117 self.assertEqual('hello'.encode('latin-1'), b'hello')
2120 self.assertEqual('\u2603'.encode(), b'\xe2\x98\x83')
2128 self.assertEqual(str(u.encode(encoding),encoding), u)
2134 self.assertEqual(str(u.encode(encoding),encoding), u)
2140 self.assertEqual(str(u.encode(encoding),encoding), u)
2147 self.assertEqual(str(u.encode(encoding),encoding), u)
2154 self.assertEqual(str(u.encode(encoding),encoding), u)
2184 self.assertEqual(str(s, encoding).encode(encoding), s)
2209 self.assertEqual(str(s, encoding).encode(encoding), s)
2212 self.assertEqual(("abc" "def"), "abcdef")
2213 self.assertEqual(("abc" "def"), "abcdef")
2214 self.assertEqual(("abc" "def"), "abcdef")
2215 self.assertEqual(("abc" "def" "ghi"), "abcdefghi")
2216 self.assertEqual(("abc" "def" "ghi"), "abcdefghi")
2237 self.assertEqual(x, y)
2241 self.assertEqual(x, y)
2244 self.assertEqual(x, y)
2249 self.assertEqual(e.start, 0)
2250 self.assertEqual(e.end, 10)
2270 self.assertEqual(str(ObjectToStr()), "foo")
2271 self.assertEqual(str(StrSubclassToStr("bar")), "foo")
2273 self.assertEqual(s, "foofoo")
2276 self.assertEqual(s, "foofoo")
2288 self.assertEqual(repr(s1()), '\\n')
2289 self.assertEqual(repr(s2()), '\\n')
2292 self.assertEqual(repr('\U00010000'), "'%c'" % (0x10000,)) # printable
2293 self.assertEqual(repr('\U00014000'), "'\\U00014000'") # nonprintable
2342 self.assertEqual("%s" % s, '__str__ overridden')
2343 self.assertEqual("{}".format(s), '__str__ overridden')
2349 self.assertEqual(S("4") + S("5"), "3")
2355 self.assertEqual(s, "3")
2361 self.assertEqual(args[0], text)
2362 self.assertEqual(len(args), 1)
2373 self.assertEqual(abc, text)
2379 self.assertEqual(abcdef, text)
2399 self.assertEqual(text1 == text2, equal)
2400 self.assertEqual(text1 != text2, not equal)
2517 self.assertEqual(proc.rc, 10, proc)
2543 self.assertEqual(expected, text)
2771 self.assertEqual(size, 2)
2772 self.assertEqual(wchar, 'ab')
2775 self.assertEqual(size, 3)
2776 self.assertEqual(wchar, 'abc')
2779 self.assertEqual(size, 3)
2780 self.assertEqual(wchar, 'abc\0')
2783 self.assertEqual(size, 3)
2784 self.assertEqual(wchar, 'abc\0')
2787 self.assertEqual(size, 7)
2788 self.assertEqual(wchar, 'abc\0def\0')
2798 self.assertEqual(size, nchar)
2799 self.assertEqual(wchar, nonbmp + '\0')
2809 self.assertEqual(size, 3)
2810 self.assertEqual(wchar, 'abc\0')
2813 self.assertEqual(size, 7)
2814 self.assertEqual(wchar, 'abc\0def\0')
2822 self.assertEqual(size, nchar)
2823 self.assertEqual(wchar, nonbmp + '\0')
2832 self.assertEqual(unicode_asucs4(s, l, True), s+'\0')
2833 self.assertEqual(unicode_asucs4(s, l, False), s+'\uffff')
2834 self.assertEqual(unicode_asucs4(s, l+1, True), s+'\0\uffff')
2835 self.assertEqual(unicode_asucs4(s, l+1, False), s+'\0\uffff')
2839 self.assertEqual(unicode_asucs4(s, len(s), True), s+'\0')
2840 self.assertEqual(unicode_asucs4(s, len(s), False), s+'\uffff')
2851 self.assertEqual(unicode_asutf8(bmp), b'\xc4\x80')
2852 self.assertEqual(unicode_asutf8(bmp2), b'\xef\xbf\xbf')
2853 self.assertEqual(unicode_asutf8(nonbmp), b'\xf4\x8f\xbf\xbf')
2865 self.assertEqual(unicode_asutf8andsize(bmp), (b'\xc4\x80', 2))
2866 self.assertEqual(unicode_asutf8andsize(bmp2), (b'\xef\xbf\xbf', 3))
2867 self.assertEqual(unicode_asutf8andsize(nonbmp), (b'\xf4\x8f\xbf\xbf', 4))
2877 self.assertEqual(unicode_findchar(str, ord(ch), 0, len(str), 1), i)
2878 self.assertEqual(unicode_findchar(str, ord(ch), 0, len(str), -1), i)
2881 self.assertEqual(unicode_findchar(str, 0x110000, 0, len(str), 1), -1)
2882 self.assertEqual(unicode_findchar(str, 0x110000, 0, len(str), -1), -1)
2884 self.assertEqual(unicode_findchar(str, ord('!'), 1, len(str)+1, 1), 4)
2885 self.assertEqual(unicode_findchar(str, ord('!'), 1, len(str)+1, -1), 4)
2887 self.assertEqual(unicode_findchar(str, ord('!'), 0, 0, 1), -1)
2888 self.assertEqual(unicode_findchar(str, ord('!'), len(str), 0, 1), -1)
2890 self.assertEqual(unicode_findchar(str, ord('!'), -len(str), -1, 1), 0)
2891 self.assertEqual(unicode_findchar(str, ord('!'), -len(str), -1, -1), 0)
2913 self.assertEqual(
2919 self.assertEqual(
2939 self.assertEqual(unicode_encodedecimal('123'),
2941 self.assertEqual(unicode_encodedecimal('\u0663.\u0661\u0664'),
2943 self.assertEqual(unicode_encodedecimal("\N{EM SPACE}3.14\N{EN SPACE}"),
2955 self.assertEqual(transform_decimal('123'),
2957 self.assertEqual(transform_decimal('\u0663.\u0661\u0664'),
2959 self.assertEqual(transform_decimal("\N{EM SPACE}3.14\N{EN SPACE}"),
2961 self.assertEqual(transform_decimal('123\u20ac'),
2977 self.assertEqual(getargs_s_hash(s), chr(k).encode() * (i + 1))
2979 self.assertEqual(getargs_s_hash(s), chr(k).encode() * (i + 1))
2987 self.assertEqual(formatter, [
2995 self.assertEqual(formatter, [
3001 self.assertEqual(formatter, [
3006 self.assertEqual(formatter, [])
3009 self.assertEqual(formatter, [
3020 self.assertEqual(split("obj"), ["obj", []])
3021 self.assertEqual(split("obj.arg"), ["obj", [(True, 'arg')]])
3022 self.assertEqual(split("obj[key]"), ["obj", [(False, 'key')]])
3023 self.assertEqual(split("obj.arg[key1][key2]"), [