Lines Matching refs:assertEqual
79 self.assertEqual(abs(0), 0)
80 self.assertEqual(abs(1234), 1234)
81 self.assertEqual(abs(-1234), 1234)
84 self.assertEqual(abs(0.0), 0.0)
85 self.assertEqual(abs(3.14), 3.14)
86 self.assertEqual(abs(-3.14), 3.14)
88 self.assertEqual(abs(0L), 0L)
89 self.assertEqual(abs(1234L), 1234L)
90 self.assertEqual(abs(-1234L), 1234L)
94 self.assertEqual(abs(True), 1)
95 self.assertEqual(abs(False), 0)
102 self.assertEqual(abs(AbsClass()), -5)
105 self.assertEqual(all([2, 4, 6]), True)
106 self.assertEqual(all([2, None, 6]), False)
112 self.assertEqual(all([]), True) # Empty iterator
113 self.assertEqual(all([0, TestFailingBool()]), False)# Short-circuit
115 self.assertEqual(all(x > 42 for x in S), True)
117 self.assertEqual(all(x > 42 for x in S), False)
120 self.assertEqual(any([None, None, None]), False)
121 self.assertEqual(any([None, 4, None]), True)
127 self.assertEqual(any([]), False) # Empty iterator
128 self.assertEqual(any([1, TestFailingBool()]), True) # Short-circuit
130 self.assertEqual(any(x > 42 for x in S), True)
132 self.assertEqual(any(x > 42 for x in S), False)
137 self.assertEqual(-x, sys.maxint+1)
141 self.assertEqual(args, ())
143 self.assertEqual(a1, 1)
145 self.assertEqual(a1, 1)
146 self.assertEqual(a2, 2)
148 self.assertEqual(a1, 1)
149 self.assertEqual(a2, 2)
150 self.assertEqual(a3, 3)
207 self.assertEqual(chr(32), ' ')
208 self.assertEqual(chr(65), 'A')
209 self.assertEqual(chr(97), 'a')
210 self.assertEqual(chr(0xff), '\xff')
215 self.assertEqual(cmp(-1, 1), -1)
216 self.assertEqual(cmp(1, -1), 1)
217 self.assertEqual(cmp(1, 1), 0)
233 self.assertEqual(coerce(1, 1L), (1L, 1L))
330 self.assertEqual(divmod(12, 7), (1, 5))
331 self.assertEqual(divmod(-12, 7), (-2, 2))
332 self.assertEqual(divmod(12, -7), (-2, -2))
333 self.assertEqual(divmod(-12, -7), (1, -5))
335 self.assertEqual(divmod(12L, 7L), (1L, 5L))
336 self.assertEqual(divmod(-12L, 7L), (-2L, 2L))
337 self.assertEqual(divmod(12L, -7L), (-2L, -2L))
338 self.assertEqual(divmod(-12L, -7L), (1L, -5L))
340 self.assertEqual(divmod(12, 7L), (1, 5L))
341 self.assertEqual(divmod(-12, 7L), (-2, 2L))
342 self.assertEqual(divmod(12L, -7), (-2L, -2))
343 self.assertEqual(divmod(-12L, -7), (1L, -5))
345 self.assertEqual(divmod(-sys.maxint-1, -1),
356 self.assertEqual(eval('1+1'), 2)
357 self.assertEqual(eval(' 1+1\n'), 2)
360 self.assertEqual(eval('a', globals) , 1)
361 self.assertEqual(eval('a', globals, locals), 1)
362 self.assertEqual(eval('b', globals, locals), 200)
363 self.assertEqual(eval('c', globals, locals), 300)
365 self.assertEqual(eval(unicode('1+1')), 2)
366 self.assertEqual(eval(unicode(' 1+1\n')), 2)
370 self.assertEqual(eval(unicode('a'), globals), 1)
371 self.assertEqual(eval(unicode('a'), globals, locals), 1)
372 self.assertEqual(eval(unicode('b'), globals, locals), 200)
373 self.assertEqual(eval(unicode('c'), globals, locals), 300)
375 self.assertEqual(eval(bom + 'a', globals, locals), 1)
376 self.assertEqual(eval(unicode('u"\xc3\xa5"', 'utf8'), globals),
395 self.assertEqual(eval('a', g, m), 12)
397 self.assertEqual(eval('dir()', g, m), list('xyz'))
398 self.assertEqual(eval('globals()', g, m), g)
399 self.assertEqual(eval('locals()', g, m), m)
417 self.assertEqual(eval('a', g, d), 12)
419 self.assertEqual(eval('dir()', g, d), list('xyz'))
420 self.assertEqual(eval('globals()', g, d), g)
421 self.assertEqual(eval('locals()', g, d), d)
439 self.assertEqual(ss['a3'], 210)
451 self.assertEqual(filter(lambda c: 'a' <= c <= 'z', 'Hello World'), 'elloorld')
452 self.assertEqual(filter(None, [1, 'hello', [], [3], '', None, 9, 0]), [1, 'hello', [3], 9])
453 self.assertEqual(filter(lambda x: x > 0, [1, -3, 9, 0, 2]), [1, 9, 2])
454 self.assertEqual(filter(None, Squares(10)), [1, 4, 9, 16, 25, 36, 49, 64, 81])
455 self.assertEqual(filter(lambda x: x%2, Squares(10)), [1, 9, 25, 49, 81])
471 self.assertEqual(filter(None, (1, 2)), (1, 2))
472 self.assertEqual(filter(lambda x: x>=3, (1, 2, 3, 4)), (3, 4))
476 self.assertEqual(filter(None, "12"), "12")
477 self.assertEqual(filter(lambda x: x>="3", "1234"), "34")
492 self.assertEqual(filter(lambda x: x>="33", weirdstr("1234")), "3344")
497 self.assertEqual(filter(lambda x: x>="3", shiftstr("1234")), "345")
501 self.assertEqual(filter(None, unicode("12")), unicode("12"))
502 self.assertEqual(filter(lambda x: x>="3", unicode("1234")), unicode("34"))
514 self.assertEqual(
520 self.assertEqual(
552 self.assertEqual(
558 self.assertEqual(outp, exp)
590 self.assertEqual(hash(1), hash(1L))
591 self.assertEqual(hash(1), hash(1.0))
594 self.assertEqual(hash('spam'), hash(unicode('spam')))
603 self.assertEqual(type(hash(X())), int)
607 self.assertEqual(type(hash(Y())), int)
611 self.assertEqual(hash(Z(42)), hash(42L))
614 self.assertEqual(hex(16), '0x10')
615 self.assertEqual(hex(16L), '0x10L')
616 self.assertEqual(hex(-16), '-0x10')
617 self.assertEqual(hex(-16L), '-0x10L')
658 self.assertEqual(getattr(s, s), s)
668 self.assertEqual(i.next(), '1')
669 self.assertEqual(i.next(), '2')
708 self.assertEqual(len('123'), 3)
709 self.assertEqual(len(()), 0)
710 self.assertEqual(len((1, 2, 3, 4)), 4)
711 self.assertEqual(len([1, 2, 3, 4]), 4)
712 self.assertEqual(len({}), 0)
713 self.assertEqual(len({'a':1, 'b': 2}), 2)
725 self.assertEqual(
729 self.assertEqual(
733 self.assertEqual(
737 self.assertEqual(
746 self.assertEqual(
750 self.assertEqual(
759 self.assertEqual(
763 self.assertEqual(
767 self.assertEqual(
771 self.assertEqual(
775 self.assertEqual(
779 self.assertEqual(
783 self.assertEqual(
789 self.assertEqual(map(None, [42]), [42])
799 self.assertEqual(max('123123'), '3')
800 self.assertEqual(max(1, 2, 3), 3)
801 self.assertEqual(max((1, 2, 3, 1, 2, 3)), 3)
802 self.assertEqual(max([1, 2, 3, 1, 2, 3]), 3)
804 self.assertEqual(max(1, 2L, 3.0), 3.0)
805 self.assertEqual(max(1L, 2.0, 3), 3)
806 self.assertEqual(max(1.0, 2, 3L), 3L)
822 self.assertEqual(max((1,), key=neg), 1) # one elem iterable
823 self.assertEqual(max((1,2), key=neg), 1) # two elem iterable
824 self.assertEqual(max(1, 2, key=neg), 1) # two elems
829 self.assertEqual(max(data, key=f),
833 self.assertEqual(min('123123'), '1')
834 self.assertEqual(min(1, 2, 3), 1)
835 self.assertEqual(min((1, 2, 3, 1, 2, 3)), 1)
836 self.assertEqual(min([1, 2, 3, 1, 2, 3]), 1)
838 self.assertEqual(min(1, 2L, 3.0), 1)
839 self.assertEqual(min(1L, 2.0, 3), 1L)
840 self.assertEqual(min(1.0, 2, 3L), 1.0)
868 self.assertEqual(min((1,), key=neg), 1) # one elem iterable
869 self.assertEqual(min((1,2), key=neg), 2) # two elem iterable
870 self.assertEqual(min(1, 2, key=neg), 2) # two elems
875 self.assertEqual(min(data, key=f),
880 self.assertEqual(next(it), 0)
881 self.assertEqual(next(it), 1)
884 self.assertEqual(next(it, 42), 42)
893 self.assertEqual(next(it, 42), 42)
901 self.assertEqual(next(it), 1)
903 self.assertEqual(next(it, 42), 42)
906 self.assertEqual(oct(100), '0144')
907 self.assertEqual(oct(100L), '0144L')
908 self.assertEqual(oct(-100), '-0144')
909 self.assertEqual(oct(-100L), '-0144L')
930 self.assertEqual(fp.readline(4), '1+1\n')
931 self.assertEqual(fp.readline(4), '1+1\n')
932 self.assertEqual(fp.readline(), 'The quick brown fox jumps over the lazy dog.\n')
933 self.assertEqual(fp.readline(4), 'Dear')
934 self.assertEqual(fp.readline(100), ' John\n')
935 self.assertEqual(fp.read(300), 'XXX'*100)
936 self.assertEqual(fp.read(1000), 'YYY'*100)
942 self.assertEqual(ord(' '), 32)
943 self.assertEqual(ord('A'), 65)
944 self.assertEqual(ord('a'), 97)
946 self.assertEqual(ord(unichr(sys.maxunicode)), sys.maxunicode)
952 self.assertEqual(pow(0,0), 1)
953 self.assertEqual(pow(0,1), 0)
954 self.assertEqual(pow(1,0), 1)
955 self.assertEqual(pow(1,1), 1)
957 self.assertEqual(pow(2,0), 1)
958 self.assertEqual(pow(2,10), 1024)
959 self.assertEqual(pow(2,20), 1024*1024)
960 self.assertEqual(pow(2,30), 1024*1024*1024)
962 self.assertEqual(pow(-2,0), 1)
963 self.assertEqual(pow(-2,1), -2)
964 self.assertEqual(pow(-2,2), 4)
965 self.assertEqual(pow(-2,3), -8)
967 self.assertEqual(pow(0L,0), 1)
968 self.assertEqual(pow(0L,1), 0)
969 self.assertEqual(pow(1L,0), 1)
970 self.assertEqual(pow(1L,1), 1)
972 self.assertEqual(pow(2L,0), 1)
973 self.assertEqual(pow(2L,10), 1024)
974 self.assertEqual(pow(2L,20), 1024*1024)
975 self.assertEqual(pow(2L,30), 1024*1024*1024)
977 self.assertEqual(pow(-2L,0), 1)
978 self.assertEqual(pow(-2L,1), -2)
979 self.assertEqual(pow(-2L,2), 4)
980 self.assertEqual(pow(-2L,3), -8)
1017 self.assertEqual(range(3), [0, 1, 2])
1018 self.assertEqual(range(1, 5), [1, 2, 3, 4])
1019 self.assertEqual(range(0), [])
1020 self.assertEqual(range(-3), [])
1021 self.assertEqual(range(1, 10, 3), [1, 4, 7])
1022 self.assertEqual(range(5, -5, -3), [5, 2, -1, -4])
1025 self.assertEqual(range(-2**100), [])
1026 self.assertEqual(range(0, -2**100), [])
1027 self.assertEqual(range(0, 2**100, -1), [])
1028 self.assertEqual(range(0, 2**100, -1), [])
1034 self.assertEqual(range(a, a+2), [a, a+1])
1035 self.assertEqual(range(a+2, a, -1L), [a+2, a+1])
1036 self.assertEqual(range(a+4, a, -2), [a+4, a+2])
1041 self.assertEqual(len(seq), 2)
1046 self.assertEqual(len(seq), 2)
1051 self.assertEqual(len(seq), 2)
1082 self.assertEqual(range(I0(bignum), I0(bignum + 1)), [bignum])
1083 self.assertEqual(range(I0(smallnum), I0(smallnum + 1)), [smallnum])
1091 self.assertEqual(range(I1(bignum), I1(bignum + 1)), [bignum])
1092 self.assertEqual(range(I1(smallnum), I1(smallnum + 1)), [smallnum])
1132 self.assertEqual(input(), 2)
1133 self.assertEqual(input('testing\n'), 2)
1134 self.assertEqual(raw_input(), 'The quick brown fox jumps over the lazy dog.')
1135 self.assertEqual(raw_input('testing\n'), 'Dear John')
1147 self.assertEqual(input(), 'whitespace')
1169 self.assertEqual(sys.stdout.getvalue().splitlines(), expected)
1183 self.assertEqual(reduce(add, ['a', 'b', 'c'], ''), 'abc')
1184 self.assertEqual(
1188 self.assertEqual(reduce(lambda x, y: x*y, range(2,8), 1), 5040)
1189 self.assertEqual(
1193 self.assertEqual(reduce(add, Squares(10)), 285)
1194 self.assertEqual(reduce(add, Squares(10), 0), 285)
1195 self.assertEqual(reduce(add, Squares(0), 0), 0)
1202 self.assertEqual(reduce(42, "1"), "1") # func is never called with one item
1203 self.assertEqual(reduce(42, "", "1"), "1") # func is never called with one item
1208 self.assertEqual(reduce(add, [], None), None)
1209 self.assertEqual(reduce(add, [], 42), 42)
1225 self.assertEqual(repr(''), '\'\'')
1226 self.assertEqual(repr(0), '0')
1227 self.assertEqual(repr(0L), '0L')
1228 self.assertEqual(repr(()), '()')
1229 self.assertEqual(repr([]), '[]')
1230 self.assertEqual(repr({}), '{}')
1233 self.assertEqual(repr(a), '[[...]]')
1236 self.assertEqual(repr(a), '{0: {...}}')
1239 self.assertEqual(round(0.0), 0.0)
1240 self.assertEqual(type(round(0.0)), float) # Will be int in 3.0.
1241 self.assertEqual(round(1.0), 1.0)
1242 self.assertEqual(round(10.0), 10.0)
1243 self.assertEqual(round(1000000000.0), 1000000000.0)
1244 self.assertEqual(round(1e20), 1e20)
1246 self.assertEqual(round(-1.0), -1.0)
1247 self.assertEqual(round(-10.0), -10.0)
1248 self.assertEqual(round(-1000000000.0), -1000000000.0)
1249 self.assertEqual(round(-1e20), -1e20)
1251 self.assertEqual(round(0.1), 0.0)
1252 self.assertEqual(round(1.1), 1.0)
1253 self.assertEqual(round(10.1), 10.0)
1254 self.assertEqual(round(1000000000.1), 1000000000.0)
1256 self.assertEqual(round(-1.1), -1.0)
1257 self.assertEqual(round(-10.1), -10.0)
1258 self.assertEqual(round(-1000000000.1), -1000000000.0)
1260 self.assertEqual(round(0.9), 1.0)
1261 self.assertEqual(round(9.9), 10.0)
1262 self.assertEqual(round(999999999.9), 1000000000.0)
1264 self.assertEqual(round(-0.9), -1.0)
1265 self.assertEqual(round(-9.9), -10.0)
1266 self.assertEqual(round(-999999999.9), -1000000000.0)
1268 self.assertEqual(round(-8.0, -1), -10.0)
1269 self.assertEqual(type(round(-8.0, -1)), float)
1271 self.assertEqual(type(round(-8.0, 0)), float)
1272 self.assertEqual(type(round(-8.0, 1)), float)
1275 self.assertEqual(round(5.5), 6)
1276 self.assertEqual(round(6.5), 7)
1277 self.assertEqual(round(-5.5), -6)
1278 self.assertEqual(round(-6.5), -7)
1281 self.assertEqual(round(0), 0)
1282 self.assertEqual(round(8), 8)
1283 self.assertEqual(round(-8), -8)
1284 self.assertEqual(type(round(0)), float) # Will be int in 3.0.
1285 self.assertEqual(type(round(-8, -1)), float)
1286 self.assertEqual(type(round(-8, 0)), float)
1287 self.assertEqual(type(round(-8, 1)), float)
1290 self.assertEqual(round(number=-8.0, ndigits=-1), -10.0)
1302 self.assertEqual(round(TestRound()), 23)
1327 self.assertEqual(round(5e15-1), 5e15-1)
1328 self.assertEqual(round(5e15), 5e15)
1329 self.assertEqual(round(5e15+1), 5e15+1)
1330 self.assertEqual(round(5e15+2), 5e15+2)
1331 self.assertEqual(round(5e15+3), 5e15+3)
1335 self.assertEqual(sys.spam, 1)
1340 self.assertEqual(sum([]), 0)
1341 self.assertEqual(sum(range(2,8)), 27)
1342 self.assertEqual(sum(iter(range(2,8))), 27)
1343 self.assertEqual(sum(Squares(10)), 285)
1344 self.assertEqual(sum(iter(Squares(10))), 285)
1345 self.assertEqual(sum([[1], [2], [3]], []), [1, 2, 3])
1362 self.assertEqual(empty, [])
1365 self.assertEqual(type(''), type('123'))
1370 self.assertEqual(unichr(32), unicode(' '))
1371 self.assertEqual(unichr(65), unicode('A'))
1372 self.assertEqual(unichr(97), unicode('a'))
1373 self.assertEqual(
1400 self.assertEqual(set(vars()), set(dir()))
1402 self.assertEqual(set(vars(sys)), set(dir(sys)))
1403 self.assertEqual(self.get_vars_f0(), {})
1404 self.assertEqual(self.get_vars_f2(), {'a': 1, 'b': 2})
1407 self.assertEqual(vars(self.C_get_vars()), {'a':2})
1413 self.assertEqual(zip(a, b), t)
1415 self.assertEqual(zip(a, b), t)
1417 self.assertEqual(zip(a, b), t)
1422 self.assertEqual(zip(a, I()), t)
1423 self.assertEqual(zip(), [])
1424 self.assertEqual(zip(*[]), [])
1439 self.assertEqual(
1455 self.assertEqual(format(3, ''), '3')
1497 self.assertEqual(format(A(3), 'spec'), '3spec')
1498 self.assertEqual(format(DerivedFromA(4), 'spec'), '4spec')
1499 self.assertEqual(format(DerivedFromSimple(5), 'abc'), '5abc')
1500 self.assertEqual(format(DerivedFromSimple2(10), 'abcdef'),
1510 self.assertEqual(format(value, ""), str(value))
1511 self.assertEqual(format(value), str(value))
1551 self.assertEqual(len(w), 1)
1556 self.assertEqual(len(w), 0)
1580 self.assertEqual(format(0, DerivedFromStr('10')), ' 0')
1583 self.assertEqual(bin(0), '0b0')
1584 self.assertEqual(bin(1), '0b1')
1585 self.assertEqual(bin(-1), '-0b1')
1586 self.assertEqual(bin(2**65), '0b1' + '0' * 65)
1587 self.assertEqual(bin(2**65-1), '0b' + '1' * 65)
1588 self.assertEqual(bin(-(2**65)), '-0b1' + '0' * 65)
1589 self.assertEqual(bin(-(2**65-1)), '-0b' + '1' * 65)
1621 self.assertEqual(self.__class__.z, 2)
1624 self.assertEqual(globals['z'], 2)
1627 self.assertEqual(locals['z'], 2)
1646 self.assertEqual(locals['z'], 2)
1662 self.assertEqual(data, sorted(copy))
1667 self.assertEqual(data, sorted(copy, cmp=lambda x, y: cmp(y,x)))
1670 self.assertEqual(data, sorted(copy, key=lambda x: -x))
1673 self.assertEqual(data, sorted(copy, reverse=1))
1682 self.assertEqual(sorted(s), sorted(T(s)))
1689 self.assertEqual(sorted(s), sorted(T(s)))
1699 self.assertEqual(A.__name__, 'A')
1700 self.assertEqual(A.__module__, __name__)
1701 self.assertEqual(A.__bases__, (object,))
1711 self.assertEqual(C.__name__, 'C')
1712 self.assertEqual(C.__module__, __name__)
1713 self.assertEqual(C.__bases__, (B, int))
1718 self.assertEqual(x, 42)
1721 self.assertEqual(x.ham(), 'ham42')
1722 self.assertEqual(x.spam(), 'spam42')
1723 self.assertEqual(x.bit_length(), 6)
1733 self.assertEqual(C.__name__, 'C')
1734 self.assertEqual(C.__module__, __name__)
1735 self.assertEqual(C.__bases__, (B, int))
1743 self.assertEqual(A.__name__, name)
1744 self.assertEqual(A.__module__, __name__)
1753 self.assertEqual(C.__name__, name)
1754 self.assertEqual(C.__module__, __name__)
1759 self.assertEqual(A.__name__, 'C')
1762 self.assertEqual(A.__name__, 'C')
1770 self.assertEqual(A.__doc__, doc)
1773 self.assertEqual(A.__doc__, None)