• Home
  • Raw
  • Download

Lines Matching +full:a630 +full:- +full:test

1 # Python test set -- part 5, built-in exceptions
13 from test.support import (captured_stderr, check_impl_detail,
17 from test.support.import_helper import import_module
18 from test.support.os_helper import TESTFN, unlink
19 from test.support.warnings_helper import check_warnings
20 from test import support
58 fp = open(TESTFN, 'w', encoding="utf-8")
60 fp = open(TESTFN, 'r', encoding="utf-8")
201 def check(self, src, lineno, offset, encoding='utf-8'):
210 line = src.split('\n')[lineno-1]
224 check(b'# -*- coding: cp1251 -*-\nPython = "\xcf\xb3\xf2\xee\xed" +',
249 check('x = 32e-+4', 1, 8)
253 check(b'# -*- coding: iso8859-7 -*-\n\xe1 = 0xI', 2, 6,
254 encoding='iso8859-7')
268 check(b"\xef\xbb\xbf#coding: utf8\nprint('\xe6\x88\x91')\n", 0, -1)
306 # test that setting an exception at the C level works even if the
383 # Non-numeric "errno"
392 'test specific to Windows')
402 # test that exception attributes are happy
521 # test for pickling support
614 # test that builtin exception don't take keyword args,
615 # but user-defined subclasses can if they want
636 return -1
728 # We want to test that the except block above got rid of
731 # must clear the latter manually for our test to succeed.
760 # Inside an exception-silencing "with" block
788 # Test that generator exception state doesn't leak into the calling
804 # Same test, but inside an exception handler
991 # C -> B -> A
1016 # Expect A -> C -> B, without cycle
1053 # +-----------+
1055 # C --> B --> A
1093 # +-----------+
1095 # E --> D --> C --> B --> A
1129 self.assertEqual(str(u), "'baz' codec can't encode characters in position 1-4: foo")
1134 …self.assertEqual(str(u), "'baz' codec can't encode characters in position 1-4: 9652309514436857249…
1136 …self.assertEqual(str(u), "'4000' codec can't encode characters in position 1-4: 965230951443685724…
1138 …self.assertEqual(str(u), "'4000' codec can't encode characters in position 1000-4: 965230951443685…
1141 self.assertEqual(str(u), "'baz' codec can't decode bytes in position 1-4: foo")
1146 … self.assertEqual(str(u), "'baz' codec can't decode bytes in position 1-4: 965230951443685724997")
1148 … self.assertEqual(str(u), "'4000' codec can't decode bytes in position 1-4: 965230951443685724997")
1150 …self.assertEqual(str(u), "'4000' codec can't decode bytes in position 1000-4: 96523095144368572499…
1153 self.assertEqual(str(u), "can't translate characters in position 1-4: foo")
1158 … self.assertEqual(str(u), "can't translate characters in position 1-4: 965230951443685724997")
1160 … self.assertEqual(str(u), "can't translate characters in position 1000-4: 965230951443685724997")
1202 # See bpo-33930
1217 # Test that a RecursionError is raised when tstate->recursion_depth is
1221 # controlled by tstate->recursion_depth and a PyExc_RecursionErrorInst
1242 cnt -= 1
1258 # tstate->recursion_depth is equal to (recursion_limit - 1)
1261 recurse(setrecursionlimit(depth + 2) - depth)
1266 rc, out, err = script_helper.assert_python_failure("-Wd", "-c", code)
1275 # Issue #30697. Test that a RecursionError is raised when
1285 rc, out, err = script_helper.assert_python_failure("-c", code)
1341 # Issue #30697. Test that in the abort that occurs when there is no
1349 cnt -= 1
1358 rc, out, err = script_helper.assert_python_failure("-c", code)
1385 doc2 = "This is a test docstring."
1386 doc4 = "This is another test docstring."
1391 # test basic usage of PyErr_NewException
1397 # test with given docstring
1401 # test with explicit base (without docstring)
1406 # test with explicit base tuple
1415 # test with explicit dictionary
1447 # Same test as above, but with "recursion exceeded" errors
1493 exc = exc_type("test message")
1506 self.assertIn("test message", report)
1522 rc, out, err = script_helper.assert_python_failure("-c", code % i)
1599 # bpo-41654: MemoryError instances use a freelist of objects that are
1602 # schema. This test creates a MemoryError object and keeps it alive
1835 a621 = a622 = a623 = a624 = a625 = a626 = a627 = a628 = a629 = a630 = \
1904 # regression test for bpo-45826
2191 exc = ImportError('test')
2195 exc = ImportError('test', name='somemodule')
2199 exc = ImportError('test', path='somepath')
2203 exc = ImportError('test', path='somepath', name='somename')
2209 ImportError('test', invalid='keyword')
2212 ImportError('test', name='name', invalid='keyword')
2215 ImportError('test', path='path', invalid='keyword')
2221 ImportError('test', invalid='keyword', another=True)
2224 exc = ImportError('test', name='name', path='path')
2225 self.assertEqual(exc.args, ('test',))
2226 self.assertEqual(exc.msg, 'test')
2249 orig = ImportError('test', **kwargs)
2252 self.assertEqual(exc.args, ('test',))
2253 self.assertEqual(exc.msg, 'test')
2258 self.assertEqual(exc.args, ('test',))
2259 self.assertEqual(exc.msg, 'test')
2266 # Basic range from 2->7
2285 (("bad.py", 1, 2, "abcdefg", 1, -2),
2303 (("bad.py", 1, -4, "abcdefg", 1, -2),
2311 (("bad.py", 1, -4, "abcdefg", 1, -5),
2356 '# -*- coding: cp437 -*-\n'
2362 rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
2363 err = err.decode('utf-8').splitlines()
2365 self.assertEqual(err[-3], ' "¢¢¢¢¢¢" + f(4, x for x in range(1))')
2366 self.assertEqual(err[-2], ' ^^^^^^^^^^^^^^^^^^^')
2371 source = '# -*- coding: ascii -*-\n\n(\n'
2375 rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
2376 err = err.decode('utf-8').splitlines()
2378 self.assertEqual(err[-3], ' (')
2379 self.assertEqual(err[-2], ' ^')
2384 # Check non utf-8 characters
2388 rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
2389 err = err.decode('utf-8').splitlines()
2391 self.assertIn("SyntaxError: Non-UTF-8 code starting with '\\x89' in file", err[-1])
2445 frame.f_lineno-frame.f_code.co_firstlineno