Lines Matching +full:a306 +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, end_lineno=None, end_offset=None, encoding='utf-8'):
215 line = src.split('\n')[lineno-1]
229 check(b'# -*- coding: cp1251 -*-\nPython = "\xcf\xb3\xf2\xee\xed" +',
260 check('x = 32e-+4', 1, 8)
264 check(b'# -*- coding: iso8859-7 -*-\n\xe1 = 0xI', 2, 6,
265 encoding='iso8859-7')
279 check(b"\xef\xbb\xbf#coding: utf8\nprint('\xe6\x88\x91')\n", 0, -1)
323 # test that setting an exception at the C level works even if the
400 # Non-numeric "errno"
409 'test specific to Windows')
419 # test that exception attributes are happy
538 # test for pickling support
658 # test that builtin exception don't take keyword args,
659 # but user-defined subclasses can if they want
680 return -1
784 # We want to test that the except block above got rid of
787 # must clear the latter manually for our test to succeed.
816 # Inside an exception-silencing "with" block
844 # Test that generator exception state doesn't leak into the calling
860 # Same test, but inside an exception handler
1047 # C -> B -> A
1072 # Expect A -> C -> B, without cycle
1109 # +-----------+
1111 # C --> B --> A
1149 # +-----------+
1151 # E --> D --> C --> B --> A
1235 self.assertEqual(str(u), "'baz' codec can't encode characters in position 1-4: foo")
1240 …self.assertEqual(str(u), "'baz' codec can't encode characters in position 1-4: 9652309514436857249…
1242 …self.assertEqual(str(u), "'4000' codec can't encode characters in position 1-4: 965230951443685724…
1244 …self.assertEqual(str(u), "'4000' codec can't encode characters in position 1000-4: 965230951443685…
1247 self.assertEqual(str(u), "'baz' codec can't decode bytes in position 1-4: foo")
1252 … self.assertEqual(str(u), "'baz' codec can't decode bytes in position 1-4: 965230951443685724997")
1254 … self.assertEqual(str(u), "'4000' codec can't decode bytes in position 1-4: 965230951443685724997")
1256 …self.assertEqual(str(u), "'4000' codec can't decode bytes in position 1000-4: 96523095144368572499…
1259 self.assertEqual(str(u), "can't translate characters in position 1-4: foo")
1264 … self.assertEqual(str(u), "can't translate characters in position 1-4: 965230951443685724997")
1266 … self.assertEqual(str(u), "can't translate characters in position 1000-4: 965230951443685724997")
1308 # See bpo-33930
1323 # Test that a RecursionError is raised when tstate->recursion_depth is
1327 # controlled by tstate->recursion_depth and a PyExc_RecursionErrorInst
1348 cnt -= 1
1364 # tstate->recursion_depth is equal to (recursion_limit - 1)
1367 recurse(setrecursionlimit(depth + 2) - depth)
1372 rc, out, err = script_helper.assert_python_failure("-Wd", "-c", code)
1381 # Issue #30697. Test that a RecursionError is raised when
1391 rc, out, err = script_helper.assert_python_failure("-c", code)
1447 # Issue #30697. Test that in the abort that occurs when there is no
1455 cnt -= 1
1464 rc, out, err = script_helper.assert_python_failure("-c", code)
1489 doc2 = "This is a test docstring."
1490 doc4 = "This is another test docstring."
1495 # test basic usage of PyErr_NewException
1501 # test with given docstring
1505 # test with explicit base (without docstring)
1510 # test with explicit base tuple
1519 # test with explicit dictionary
1551 # Same test as above, but with "recursion exceeded" errors
1597 exc = exc_type("test message")
1610 self.assertIn("test message", report)
1626 rc, out, err = script_helper.assert_python_failure("-c", code % i)
1703 # bpo-41654: MemoryError instances use a freelist of objects that are
1706 # schema. This test creates a MemoryError object and keeps it alive
1907 a301 = a302 = a303 = a304 = a305 = a306 = a307 = a308 = a309 = a310 = \
2008 # regression test for bpo-45826
2318 exc = ImportError('test')
2322 exc = ImportError('test', name='somemodule')
2326 exc = ImportError('test', path='somepath')
2330 exc = ImportError('test', path='somepath', name='somename')
2336 ImportError('test', invalid='keyword')
2339 ImportError('test', name='name', invalid='keyword')
2342 ImportError('test', path='path', invalid='keyword')
2348 ImportError('test', invalid='keyword', another=True)
2351 exc = ImportError('test', name='name', path='path')
2352 self.assertEqual(exc.args, ('test',))
2353 self.assertEqual(exc.msg, 'test')
2376 orig = ImportError('test', **kwargs)
2379 self.assertEqual(exc.args, ('test',))
2380 self.assertEqual(exc.msg, 'test')
2385 self.assertEqual(exc.args, ('test',))
2386 self.assertEqual(exc.msg, 'test')
2393 # Basic range from 2->7
2412 (("bad.py", 1, 2, "abcdefg", 1, -2),
2430 (("bad.py", 1, -4, "abcdefg", 1, -2),
2438 (("bad.py", 1, -4, "abcdefg", 1, -5),
2483 '# -*- coding: cp437 -*-\n'
2489 rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
2490 err = err.decode('utf-8').splitlines()
2492 self.assertEqual(err[-3], ' "¢¢¢¢¢¢" + f(4, x for x in range(1))')
2493 self.assertEqual(err[-2], ' ^^^^^^^^^^^^^^^^^^^')
2498 source = '# -*- coding: ascii -*-\n\n(\n'
2502 rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
2503 err = err.decode('utf-8').splitlines()
2505 self.assertEqual(err[-3], ' (')
2506 self.assertEqual(err[-2], ' ^')
2511 # Check non utf-8 characters
2515 rc, out, err = script_helper.assert_python_failure('-Wd', '-X', 'utf8', TESTFN)
2516 err = err.decode('utf-8').splitlines()
2518 self.assertIn("SyntaxError: Non-UTF-8 code starting with '\\x89' in file", err[-1])
2587 frame.f_lineno-frame.f_code.co_firstlineno