Lines Matching refs:assertRaises
72 self.assertRaises(ImportError, __import__, 'spamspam')
73 self.assertRaises(TypeError, __import__, 1, 2, 3, 4)
74 self.assertRaises(ValueError, __import__, '')
75 self.assertRaises(TypeError, __import__, 'sys', name='sys')
92 self.assertRaises(TypeError, abs, 'a')
97 self.assertRaises(TypeError, abs)
98 self.assertRaises(TypeError, abs, None)
107 self.assertRaises(RuntimeError, all, [2, TestFailingBool(), 6])
108 self.assertRaises(RuntimeError, all, TestFailingIter())
109 self.assertRaises(TypeError, all, 10) # Non-iterable
110 self.assertRaises(TypeError, all) # No args
111 self.assertRaises(TypeError, all, [2, 4, 6], []) # Too many args
122 self.assertRaises(RuntimeError, any, [None, TestFailingBool(), 6])
123 self.assertRaises(RuntimeError, any, TestFailingIter())
124 self.assertRaises(TypeError, any, 10) # Non-iterable
125 self.assertRaises(TypeError, any) # No args
126 self.assertRaises(TypeError, any, [2, 4, 6], []) # Too many args
160 self.assertRaises(TypeError, apply, id, (1,), {"foo": 1})
161 self.assertRaises(TypeError, apply)
162 self.assertRaises(TypeError, apply, id, 42)
163 self.assertRaises(TypeError, apply, id, (42,), 42)
211 self.assertRaises(ValueError, chr, 256)
212 self.assertRaises(TypeError, chr)
223 self.assertRaises(RuntimeError, cmp, a, b)
224 self.assertRaises(RuntimeError, cmp, b, c)
225 self.assertRaises(RuntimeError, cmp, c, a)
226 self.assertRaises(RuntimeError, cmp, a, c)
229 self.assertRaises(TypeError, cmp)
235 self.assertRaises(TypeError, coerce)
239 self.assertRaises(ValueError, coerce, 42, BadNumber())
240 self.assertRaises(OverflowError, coerce, 0.5, int("12345" * 1000))
249 self.assertRaises(TypeError, compile)
250 self.assertRaises(ValueError, compile, 'print 42\n', '<string>', 'badmode')
251 self.assertRaises(ValueError, compile, 'print 42\n', '<string>', 'single', 0xff)
252 self.assertRaises(TypeError, compile, chr(0), 'f', 'exec')
253 self.assertRaises(TypeError, compile, 'pass', '?', 'exec',
257 self.assertRaises(TypeError, compile, unichr(0), 'f', 'exec')
258 self.assertRaises(ValueError, compile, unicode('a = 1'), 'f', 'bad')
265 self.assertRaises(TypeError, delattr)
269 self.assertRaises(TypeError, dir, 42, 42)
284 self.assertRaises(TypeError, dir, f)
327 self.assertRaises(TypeError, dir, f)
353 self.assertRaises(TypeError, divmod)
378 self.assertRaises(TypeError, eval)
379 self.assertRaises(TypeError, eval, ())
396 self.assertRaises(NameError, eval, 'b', g, m)
400 self.assertRaises(TypeError, eval, 'a', m)
405 self.assertRaises(TypeError, eval, 'a', g, m)
418 self.assertRaises(NameError, eval, 'b', g, d)
448 self.assertRaises(TypeError, eval, 'dir()', globals(), C())
459 self.assertRaises(TypeError, filter)
465 self.assertRaises(ValueError, filter, lambda x: x, BadSeq())
468 self.assertRaises(TypeError, filter, badfunc, range(5))
473 self.assertRaises(TypeError, filter, 42, (1, 2))
478 self.assertRaises(TypeError, filter, 42, "12")
482 self.assertRaises(ValueError, filter, lambda x: x >="3", badstr("1234"))
487 self.assertRaises(TypeError, filter, lambda x: x >=42, badstr2("1234"))
503 self.assertRaises(TypeError, filter, 42, unicode("12"))
504 self.assertRaises(ValueError, filter, lambda x: x >="3", badstr(unicode("1234")))
509 self.assertRaises(TypeError, filter, lambda x: x >=42, badunicode("1234"))
564 self.assertRaises(TypeError, getattr, sys, 1)
565 self.assertRaises(TypeError, getattr, sys, 1, "foo")
566 self.assertRaises(TypeError, getattr)
568 self.assertRaises(UnicodeError, getattr, sys, unichr(sys.maxunicode))
573 self.assertRaises(TypeError, hasattr, sys, 1)
574 self.assertRaises(TypeError, hasattr)
576 self.assertRaises(UnicodeError, hasattr, sys, unichr(sys.maxunicode))
582 self.assertRaises(KeyboardInterrupt, hasattr, A(), "b")
586 self.assertRaises(SystemExit, hasattr, B(), "b")
597 self.assertRaises(TypeError, hash, [])
598 self.assertRaises(TypeError, hash, {})
618 self.assertRaises(TypeError, hex, {})
635 self.assertRaises(TypeError, intern)
652 self.assertRaises(TypeError, intern, S("abc"))
661 self.assertRaises(TypeError, iter)
662 self.assertRaises(TypeError, iter, 42, 42)
670 self.assertRaises(StopIteration, i.next)
687 self.assertRaises(TypeError, isinstance, E, 'foo')
688 self.assertRaises(TypeError, isinstance)
703 self.assertRaises(TypeError, issubclass, 'foo', E)
704 self.assertRaises(TypeError, issubclass, E, 'foo')
705 self.assertRaises(TypeError, issubclass)
717 self.assertRaises(ValueError, len, BadSeq())
718 self.assertRaises(TypeError, len, 2)
721 self.assertRaises(AttributeError, len, ClassicStyle())
722 self.assertRaises(TypeError, len, NewStyle())
787 self.assertRaises(TypeError, map)
788 self.assertRaises(TypeError, map, lambda x: x, 42)
793 self.assertRaises(ValueError, map, lambda x: x, BadSeq())
796 self.assertRaises(RuntimeError, map, badfunc, range(5))
842 self.assertRaises(TypeError, min)
843 self.assertRaises(TypeError, min, 42)
844 self.assertRaises(ValueError, min, ())
848 self.assertRaises(ValueError, min, BadSeq())
852 self.assertRaises(ValueError, min, (42, BadNumber()))
882 self.assertRaises(StopIteration, next, it)
883 self.assertRaises(StopIteration, next, it)
894 self.assertRaises(StopIteration, next, it)
902 self.assertRaises(StopIteration, next, it)
910 self.assertRaises(TypeError, oct, ())
947 self.assertRaises(TypeError, ord, 42)
949 self.assertRaises(TypeError, ord, unicode("12"))
1003 self.assertRaises(TypeError, pow, x, y, z)
1007 self.assertRaises(TypeError, pow, -1, -2, 3)
1008 self.assertRaises(ValueError, pow, 1, 2, 0)
1009 self.assertRaises(TypeError, pow, -1L, -2L, 3L)
1010 self.assertRaises(ValueError, pow, 1L, 2L, 0L)
1012 self.assertRaises(ValueError, pow, -342.43, 0.234)
1014 self.assertRaises(TypeError, pow)
1053 self.assertRaises(TypeError, range)
1054 self.assertRaises(TypeError, range, 1, 2, 3, 4)
1055 self.assertRaises(ValueError, range, 1, 2, 0)
1056 self.assertRaises(ValueError, range, a, a + 1, long(0))
1062 self.assertRaises(RuntimeError, range, a, a + 1, badzero(1))
1065 self.assertRaises(TypeError, range, 1., 1., 1.)
1066 self.assertRaises(TypeError, range, 1e100, 1e101, 1e101)
1068 self.assertRaises(TypeError, range, 0, "spam")
1069 self.assertRaises(TypeError, range, 0, 42, "spam")
1071 self.assertRaises(OverflowError, range, -sys.maxint, sys.maxint)
1072 self.assertRaises(OverflowError, range, 0, 2*sys.maxint)
1098 self.assertRaises(RuntimeError, range, IX())
1104 self.assertRaises(TypeError, range, IN())
1108 self.assertRaises(TypeError, range, 0.0)
1110 self.assertRaises(TypeError, range, 0, 0.0)
1111 self.assertRaises(TypeError, range, 0.0, 0)
1112 self.assertRaises(TypeError, range, 0.0, 0.0)
1114 self.assertRaises(TypeError, range, 0, 0, 1.0)
1115 self.assertRaises(TypeError, range, 0, 0.0, 1)
1116 self.assertRaises(TypeError, range, 0, 0.0, 1.0)
1117 self.assertRaises(TypeError, range, 0.0, 0, 1)
1118 self.assertRaises(TypeError, range, 0.0, 0, 1.0)
1119 self.assertRaises(TypeError, range, 0.0, 0.0, 1)
1120 self.assertRaises(TypeError, range, 0.0, 0.0, 1.0)
1141 self.assertRaises(ValueError, input)
1145 self.assertRaises(TypeError, input, 42, 42)
1149 self.assertRaises(EOFError, input)
1172 self.assertRaises(RuntimeError, input, 'prompt')
1174 self.assertRaises(RuntimeError, input, 'prompt')
1196 self.assertRaises(TypeError, reduce)
1197 self.assertRaises(TypeError, reduce, 42)
1198 self.assertRaises(TypeError, reduce, 42, 42)
1199 self.assertRaises(TypeError, reduce, 42, 42, 42)
1200 self.assertRaises(TypeError, reduce, None, range(5))
1201 self.assertRaises(TypeError, reduce, add, 42)
1204 self.assertRaises(TypeError, reduce, 42, (42, 42))
1205 …self.assertRaises(TypeError, reduce, add, []) # arg 2 must not be empty sequence with no initial v…
1206 self.assertRaises(TypeError, reduce, add, "")
1207 self.assertRaises(TypeError, reduce, add, ())
1214 self.assertRaises(ValueError, reduce, 42, BadSeq())
1292 self.assertRaises(TypeError, round)
1304 self.assertRaises(TypeError, round, 1, 2, 3)
1305 self.assertRaises(TypeError, round, TestNoRound())
1309 self.assertRaises(TypeError, round, t)
1310 self.assertRaises(TypeError, round, t, 0)
1336 self.assertRaises(TypeError, setattr, sys, 1, 'spam')
1337 self.assertRaises(TypeError, setattr)
1347 self.assertRaises(TypeError, sum)
1348 self.assertRaises(TypeError, sum, 42)
1349 self.assertRaises(TypeError, sum, ['a', 'b', 'c'])
1350 self.assertRaises(TypeError, sum, ['a', 'b', 'c'], '')
1351 self.assertRaises(TypeError, sum, [[1], [2], [3]])
1352 self.assertRaises(TypeError, sum, [{2:3}])
1353 self.assertRaises(TypeError, sum, [{2:3}]*2, {2:3})
1358 self.assertRaises(ValueError, sum, BadSeq())
1377 self.assertRaises(ValueError, unichr, sys.maxunicode+1)
1378 self.assertRaises(TypeError, unichr)
1379 self.assertRaises((OverflowError, ValueError), unichr, 2**32)
1405 self.assertRaises(TypeError, vars, 42, 42)
1406 self.assertRaises(TypeError, vars, 42)
1425 self.assertRaises(TypeError, zip, None)
1428 self.assertRaises(TypeError, zip, a, G())
1450 self.assertRaises(ValueError, zip, BadSeq(), BadSeq())
1527 self.assertRaises(TypeError, format, BadFormatResult(), "")
1530 self.assertRaises(TypeError, format, object(), 4)
1531 self.assertRaises(TypeError, format, object(), object())
1539 self.assertRaises(TypeError, object().__format__, 3)
1540 self.assertRaises(TypeError, object().__format__, object())
1541 self.assertRaises(TypeError, object().__format__, None)
1593 self.assertRaises(ValueError, x.translate, "1", 1)
1594 self.assertRaises(TypeError, x.translate, "1"*256, 1)
1649 self.assertRaises(TypeError, execfile)
1650 self.assertRaises(TypeError, execfile, TESTFN, {}, ())
1652 self.assertRaises(IOError, execfile, os.curdir)
1653 self.assertRaises(IOError, execfile, "I_dont_exist")
1693 self.assertRaises(TypeError, sorted, data, None, lambda x,y: 0)
1745 with self.assertRaises(ValueError):
1747 with self.assertRaises(TypeError):
1757 with self.assertRaises(ValueError):
1760 with self.assertRaises(TypeError):
1774 with self.assertRaises(AttributeError):
1778 with self.assertRaises(TypeError):
1780 with self.assertRaises(TypeError):
1782 with self.assertRaises(TypeError):
1784 with self.assertRaises(TypeError):
1786 with self.assertRaises(TypeError):
1788 with self.assertRaises(TypeError):
1790 with self.assertRaises(TypeError):
1792 with self.assertRaises(TypeError):
1794 with self.assertRaises(TypeError):
1798 with self.assertRaises(TypeError):
1802 with self.assertRaises(TypeError):
1804 with self.assertRaises(TypeError):
1806 with self.assertRaises(TypeError):
1808 with self.assertRaises(TypeError):
1810 with self.assertRaises(TypeError):
1812 with self.assertRaises(TypeError):
1817 with self.assertRaises(TypeError):
1819 with self.assertRaises(TypeError):