Lines Matching refs:assertRaises
161 self.assertRaises(ImportError, __import__, 'spamspam')
162 self.assertRaises(TypeError, __import__, 1, 2, 3, 4)
163 self.assertRaises(ValueError, __import__, '')
164 self.assertRaises(TypeError, __import__, 'sys', name='sys')
167 self.assertRaises(ImportError, __import__, '',
171 self.assertRaises(ModuleNotFoundError, __import__, 'string\x00')
184 self.assertRaises(TypeError, abs, 'a')
189 self.assertRaises(TypeError, abs)
190 self.assertRaises(TypeError, abs, None)
199 self.assertRaises(RuntimeError, all, [2, TestFailingBool(), 6])
200 self.assertRaises(RuntimeError, all, TestFailingIter())
201 self.assertRaises(TypeError, all, 10) # Non-iterable
202 self.assertRaises(TypeError, all) # No args
203 self.assertRaises(TypeError, all, [2, 4, 6], []) # Too many args
214 self.assertRaises(RuntimeError, any, [None, TestFailingBool(), 6])
215 self.assertRaises(RuntimeError, any, TestFailingIter())
216 self.assertRaises(TypeError, any, 10) # Non-iterable
217 self.assertRaises(TypeError, any) # No args
218 self.assertRaises(TypeError, any, [2, 4, 6], []) # Too many args
305 self.assertRaises(ValueError, chr, 1<<24)
308 self.assertRaises(TypeError, chr)
318 self.assertRaises(ValueError, chr, -1)
319 self.assertRaises(ValueError, chr, 0x00110000)
320 self.assertRaises((OverflowError, ValueError), chr, 2**32)
333 self.assertRaises(TypeError, compile)
334 self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'badmode')
335 self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'single', 0xff)
336 self.assertRaises(ValueError, compile, chr(0), 'f', 'exec')
337 self.assertRaises(TypeError, compile, 'pass', '?', 'exec',
340 self.assertRaises(ValueError, compile, chr(0), 'f', 'exec')
341 self.assertRaises(ValueError, compile, str('a = 1'), 'f', 'bad')
428 with self.assertRaises(
477 with self.assertRaises(
481 with self.assertRaises(
510 self.assertRaises(TypeError, delattr)
514 self.assertRaises(TypeError, dir, 42, 42)
527 self.assertRaises(TypeError, dir, f)
578 self.assertRaises(TypeError, dir, f)
605 self.assertRaises(TypeError, divmod)
621 self.assertRaises(TypeError, eval)
622 self.assertRaises(TypeError, eval, ())
623 self.assertRaises(SyntaxError, eval, bom[:2] + b'a')
628 self.assertRaises(ValueError, eval, "foo", {}, X())
645 self.assertRaises(NameError, eval, 'b', g, m)
649 self.assertRaises(TypeError, eval, 'a', m)
654 self.assertRaises(TypeError, eval, 'a', g, m)
667 self.assertRaises(NameError, eval, 'b', g, d)
697 self.assertRaises(TypeError, eval, 'dir()', globals(), C())
729 self.assertRaises(TypeError,
750 self.assertRaises(frozendict_error,
756 self.assertRaises(frozendict_error,
779 self.assertRaises(TypeError, filter)
785 self.assertRaises(ValueError, list, filter(lambda x: x, BadSeq()))
788 self.assertRaises(TypeError, list, filter(badfunc, range(5)))
793 self.assertRaises(TypeError, list, filter(42, (1, 2)))
803 self.assertRaises(TypeError, getattr, sys, 1)
804 self.assertRaises(TypeError, getattr, sys, 1, "foo")
805 self.assertRaises(TypeError, getattr)
806 self.assertRaises(AttributeError, getattr, sys, chr(sys.maxunicode))
808 self.assertRaises(AttributeError, getattr, 1, "\uDAD1\uD51E")
812 self.assertRaises(TypeError, hasattr, sys, 1)
813 self.assertRaises(TypeError, hasattr)
821 self.assertRaises(SystemExit, hasattr, A(), "b")
825 self.assertRaises(ValueError, hasattr, B(), "b")
836 self.assertRaises(TypeError, hash, [])
837 self.assertRaises(TypeError, hash, {})
851 self.assertRaises(TypeError, hex, {})
865 self.assertRaises(TypeError, iter)
866 self.assertRaises(TypeError, iter, 42, 42)
872 self.assertRaises(StopIteration, next, i)
889 self.assertRaises(TypeError, isinstance, E, 'foo')
890 self.assertRaises(TypeError, isinstance)
905 self.assertRaises(TypeError, issubclass, 'foo', E)
906 self.assertRaises(TypeError, issubclass, E, 'foo')
907 self.assertRaises(TypeError, issubclass)
919 self.assertRaises(ValueError, len, BadSeq())
923 self.assertRaises(TypeError, len, InvalidLen())
927 self.assertRaises(TypeError, len, FloatLen())
931 self.assertRaises(ValueError, len, NegativeLen())
935 self.assertRaises(OverflowError, len, HugeLen())
939 self.assertRaises(ValueError, len, HugeNegativeLen())
941 self.assertRaises(TypeError, len, NoLenMethod())
992 self.assertRaises(TypeError, map)
993 self.assertRaises(TypeError, map, lambda x: x, 42)
998 self.assertRaises(ValueError, list, map(lambda x: x, BadSeq()))
1001 self.assertRaises(RuntimeError, list, map(badfunc, range(5)))
1025 self.assertRaises(TypeError, max, 42)
1026 self.assertRaises(ValueError, max, ())
1030 self.assertRaises(ValueError, max, BadSeq())
1084 self.assertRaises(TypeError, min, 42)
1085 self.assertRaises(ValueError, min, ())
1089 self.assertRaises(ValueError, min, BadSeq())
1131 self.assertRaises(StopIteration, next, it)
1132 self.assertRaises(StopIteration, next, it)
1143 self.assertRaises(StopIteration, next, it)
1151 self.assertRaises(StopIteration, next, it)
1157 self.assertRaises(TypeError, oct, ())
1183 self.assertRaises(ValueError, open, 'a\x00b')
1184 self.assertRaises(ValueError, open, b'a\x00b')
1225 self.assertRaises(TypeError, ord, 42)
1275 self.assertRaises(TypeError, pow, x, y, z)
1284 self.assertRaises(ValueError, pow, 1, 2, 0)
1286 self.assertRaises(TypeError, pow)
1316 self.assertRaises(ValueError, input)
1320 self.assertRaises(TypeError, input, 42, 42)
1324 self.assertRaises(EOFError, input)
1327 self.assertRaises(RuntimeError, input, 'prompt')
1329 self.assertRaises(RuntimeError, input, 'prompt')
1404 self.assertRaises(TypeError, round)
1416 self.assertRaises(TypeError, round, 1, 2, 3)
1417 self.assertRaises(TypeError, round, TestNoRound())
1421 self.assertRaises(TypeError, round, t)
1422 self.assertRaises(TypeError, round, t, 0)
1457 self.assertRaises(TypeError, setattr, sys, 1, 'spam')
1458 self.assertRaises(TypeError, setattr)
1491 self.assertRaises(TypeError, sum)
1492 self.assertRaises(TypeError, sum, 42)
1493 self.assertRaises(TypeError, sum, ['a', 'b', 'c'])
1494 self.assertRaises(TypeError, sum, ['a', 'b', 'c'], '')
1495 self.assertRaises(TypeError, sum, [b'a', b'c'], b'')
1497 self.assertRaises(TypeError, sum, values, bytearray(b''))
1498 self.assertRaises(TypeError, sum, [[1], [2], [3]])
1499 self.assertRaises(TypeError, sum, [{2:3}])
1500 self.assertRaises(TypeError, sum, [{2:3}]*2, {2:3})
1501 self.assertRaises(TypeError, sum, [], '')
1502 self.assertRaises(TypeError, sum, [], b'')
1503 self.assertRaises(TypeError, sum, [], bytearray())
1508 self.assertRaises(ValueError, sum, BadSeq())
1541 self.assertRaises(TypeError, vars, 42, 42)
1542 self.assertRaises(TypeError, vars, 42)
1561 self.assertRaises(TypeError, zip, None)
1564 self.assertRaises(TypeError, zip, a, G())
1565 self.assertRaises(RuntimeError, zip, a, TestFailingIter())
1587 self.assertRaises(ValueError, list, zip(BadSeq(), BadSeq()))
1604 with self.assertRaises(TypeError) as cm:
1664 self.assertRaises(TypeError, format, BadFormatResult(), "")
1667 self.assertRaises(TypeError, format, object(), 4)
1668 self.assertRaises(TypeError, format, object(), object())
1676 self.assertRaises(TypeError, object().__format__, 3)
1677 self.assertRaises(TypeError, object().__format__, object())
1678 self.assertRaises(TypeError, object().__format__, None)
1721 self.assertRaises(ValueError, x.translate, b"1", 1)
1722 self.assertRaises(TypeError, x.translate, b"1"*256, 1)
1727 self.assertRaises(ValueError, array.extend, bad_iter)
1733 self.assertRaises(TypeError, tp, 1, 2)
1734 self.assertRaises(TypeError, tp, a=1, b=2)
1799 self.assertRaises(TypeError, breakpoint, 1, 2, 3, four=4, five=5)
2013 with self.assertRaises(TypeError):
2017 with self.assertRaises(TypeError):
2033 self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0)
2102 with self.assertRaises(TypeError):
2104 with self.assertRaises(TypeError):
2114 with self.assertRaises(ValueError):
2116 with self.assertRaises(ValueError):
2118 with self.assertRaises(TypeError):
2130 with self.assertRaises(ValueError):
2133 with self.assertRaises(ValueError):
2136 with self.assertRaises(TypeError):
2145 with self.assertRaises(TypeError):
2152 with self.assertRaises(TypeError):
2160 with self.assertRaises(UnicodeEncodeError):
2170 with self.assertRaises(TypeError):
2172 with self.assertRaises(TypeError):
2174 with self.assertRaises(TypeError):
2176 with self.assertRaises(TypeError):
2178 with self.assertRaises(TypeError):
2180 with self.assertRaises(TypeError):
2182 with self.assertRaises(TypeError):
2184 with self.assertRaises(TypeError):
2186 with self.assertRaises(TypeError):
2190 with self.assertRaises(TypeError):
2192 with self.assertRaises(TypeError):
2194 with self.assertRaises(TypeError):
2196 with self.assertRaises(TypeError):
2198 with self.assertRaises(TypeError):
2200 with self.assertRaises(ValueError):
2202 with self.assertRaises(TypeError):
2204 with self.assertRaises(TypeError):
2209 with self.assertRaises(TypeError):
2211 with self.assertRaises(TypeError):