• Home
  • Raw
  • Download

Lines Matching +full:shebang +full:- +full:regex

108         # Make sure that if `-X no_debug_ranges` is used, there are no carets
115 '-X', 'no_debug_ranges', TESTFN)
139 '-X', 'no_debug_ranges', TESTFN)
211 # - correct line number (Issue2384)
212 # - respect file encoding (Issue3975)
218 process = subprocess.Popen([sys.executable, "-c",
262 for charset in ("ascii", "iso-8859-1", "utf-8", "GBK"):
271 do_test("#!shebang\n# coding: {0}\n".format(charset),
276 do_test("x=0\n# coding: GBK\n", "h\xe9 ho", 'utf-8', 5)
303 rc, stdout, stderr = assert_python_ok('-c', code)
329 with self.assertRaisesRegex(TypeError, 'positional-only'):
385 return traceback.format_exc().splitlines()[:-1]
408 # Make sure that even if a line contains multi-byte unicode characters
427 def foo(a: THIS_DOES_NOT_EXIST ) -> int:
436 ' def foo(a: THIS_DOES_NOT_EXIST ) -> int:\n'
680 f' | ExceptionGroup: eg (2 sub-exceptions)\n'
681 f' +-+---------------- 1 ----------------\n'
683 f' +---------------- 2 ----------------\n'
691 specialization_line = result_lines[-1]
879 return tbstderr.getvalue().splitlines()[:-1]
929 location, source_line = tb_lines[-2], tb_lines[-1]
962 self.assertEqual(stderr.getvalue().splitlines()[-4:], [
969 # issue 26823 - Shrink recursive tracebacks
1000 # are run through the interactive interpreter or with -m
1002 # Fortunately, we don't care about exactness here, so we use regex
1012 self.assertEqual(actual[:-2], expected[:-2])
1013 self.assertRegex(actual[-2], expected[-2])
1015 self.assertIn(expected[-1], actual[-1])
1019 self.assertIn(int(re.search(r"\d+", actual[-2]).group()), range(rec_limit-60, rec_limit))
1024 return g(count-1)
1038 ' return g(count-1)\n'
1041 ' return g(count-1)\n'
1044 ' return g(count-1)\n'
1063 return h(count-1)
1080 ' return h(count-1)\n'
1083 ' return h(count-1)\n'
1086 ' return h(count-1)\n'
1106 ' return g(count-1)\n'
1109 ' return g(count-1)\n'
1112 ' return g(count-1)\n'
1137 ' return g(count-1)\n'
1140 ' return g(count-1)\n'
1143 ' return g(count-1)\n'
1177 self.assertEqual(result[-2:], [
1285 self.assertTrue(lines[-3].startswith(' File'))
1286 self.assertIn('1/0 # In zero_div', lines[-2])
1288 self.assertTrue(lines[-4].startswith(' File'))
1289 self.assertIn('1/0 # In zero_div', lines[-3])
1290 self.assertTrue(lines[-1].startswith('ZeroDivisionError'), lines[-1])
1390 # re-raised from the KeyError
1399 self.assertEqual(msg[-2], " ^")
1403 self.assertEqual(msg[-2], ' ^')
1442 for offset in range(-5, 10):
1450 expected.append(" %s^" % (" "*(offset-1)))
1482 # non-sequence __notes__
1490 # unprintable, non-sequence __notes__
1503 # non-string item in the __notes__ sequence
1508 # unprintable, non-string item in the __notes__ sequence
1598 f' | ExceptionGroup: eg (2 sub-exceptions)\n'
1599 f' +-+---------------- 1 ----------------\n'
1601 f' +---------------- 2 ----------------\n'
1603 f' +------------------------------------\n')
1619 f' | ExceptionGroup: eg1 (2 sub-exceptions)\n'
1620 f' +-+---------------- 1 ----------------\n'
1622 f' +---------------- 2 ----------------\n'
1624 f' +------------------------------------\n'
1633 f' | ExceptionGroup: eg2 (2 sub-exceptions)\n'
1634 f' +-+---------------- 1 ----------------\n'
1636 f' +---------------- 2 ----------------\n'
1638 f' +------------------------------------\n')
1658 f' | ExceptionGroup: eg1 (2 sub-exceptions)\n'
1659 f' +-+---------------- 1 ----------------\n'
1661 f' +---------------- 2 ----------------\n'
1663 f' +------------------------------------\n'
1670 f' | ExceptionGroup: eg2 (2 sub-exceptions)\n'
1671 f' +-+---------------- 1 ----------------\n'
1673 f' +---------------- 2 ----------------\n'
1675 f' +------------------------------------\n'
1706 f' | ExceptionGroup: eg (3 sub-exceptions)\n'
1707 f' +-+---------------- 1 ----------------\n'
1709 f' +---------------- 2 ----------------\n'
1713 f' | ExceptionGroup: nested (2 sub-exceptions)\n'
1714 f' +-+---------------- 1 ----------------\n'
1716 f' +---------------- 2 ----------------\n'
1718 f' +------------------------------------\n'
1719 f' +---------------- 3 ----------------\n'
1721 f' +------------------------------------\n'
1730 f' | ExceptionGroup: top (1 sub-exception)\n'
1731 f' +-+---------------- 1 ----------------\n'
1733 f' +------------------------------------\n')
1744 expected = (' | ExceptionGroup: eg (1000 sub-exceptions)\n'
1745 ' +-+---------------- 1 ----------------\n'
1747 ' +---------------- 2 ----------------\n'
1749 ' +---------------- 3 ----------------\n'
1751 ' +---------------- 4 ----------------\n'
1753 ' +---------------- 5 ----------------\n'
1755 ' +---------------- 6 ----------------\n'
1757 ' +---------------- 7 ----------------\n'
1759 ' +---------------- 8 ----------------\n'
1761 ' +---------------- 9 ----------------\n'
1763 ' +---------------- 10 ----------------\n'
1765 ' +---------------- 11 ----------------\n'
1767 ' +---------------- 12 ----------------\n'
1769 ' +---------------- 13 ----------------\n'
1771 ' +---------------- 14 ----------------\n'
1773 ' +---------------- 15 ----------------\n'
1775 ' +---------------- ... ----------------\n'
1777 ' +------------------------------------\n')
1787 [ValueError(i), exc, ValueError(-i)])
1789 expected = (' | ExceptionGroup: eg999 (3 sub-exceptions)\n'
1790 ' +-+---------------- 1 ----------------\n'
1792 ' +---------------- 2 ----------------\n'
1793 ' | ExceptionGroup: eg998 (3 sub-exceptions)\n'
1794 ' +-+---------------- 1 ----------------\n'
1796 ' +---------------- 2 ----------------\n'
1797 ' | ExceptionGroup: eg997 (3 sub-exceptions)\n'
1798 ' +-+---------------- 1 ----------------\n'
1800 ' +---------------- 2 ----------------\n'
1801 ' | ExceptionGroup: eg996 (3 sub-exceptions)\n'
1802 ' +-+---------------- 1 ----------------\n'
1804 ' +---------------- 2 ----------------\n'
1805 ' | ExceptionGroup: eg995 (3 sub-exceptions)\n'
1806 ' +-+---------------- 1 ----------------\n'
1808 ' +---------------- 2 ----------------\n'
1809 ' | ExceptionGroup: eg994 (3 sub-exceptions)\n'
1810 ' +-+---------------- 1 ----------------\n'
1812 ' +---------------- 2 ----------------\n'
1813 ' | ExceptionGroup: eg993 (3 sub-exceptions)\n'
1814 ' +-+---------------- 1 ----------------\n'
1816 ' +---------------- 2 ----------------\n'
1817 ' | ExceptionGroup: eg992 (3 sub-exceptions)\n'
1818 ' +-+---------------- 1 ----------------\n'
1820 ' +---------------- 2 ----------------\n'
1821 ' | ExceptionGroup: eg991 (3 sub-exceptions)\n'
1822 ' +-+---------------- 1 ----------------\n'
1824 ' +---------------- 2 ----------------\n'
1825 ' | ExceptionGroup: eg990 (3 sub-exceptions)\n'
1826 ' +-+---------------- 1 ----------------\n'
1828 ' +---------------- 2 ----------------\n'
1830 ' +---------------- 3 ----------------\n'
1831 ' | ValueError: -990\n'
1832 ' +------------------------------------\n'
1833 ' +---------------- 3 ----------------\n'
1834 ' | ValueError: -991\n'
1835 ' +------------------------------------\n'
1836 ' +---------------- 3 ----------------\n'
1837 ' | ValueError: -992\n'
1838 ' +------------------------------------\n'
1839 ' +---------------- 3 ----------------\n'
1840 ' | ValueError: -993\n'
1841 ' +------------------------------------\n'
1842 ' +---------------- 3 ----------------\n'
1843 ' | ValueError: -994\n'
1844 ' +------------------------------------\n'
1845 ' +---------------- 3 ----------------\n'
1846 ' | ValueError: -995\n'
1847 ' +------------------------------------\n'
1848 ' +---------------- 3 ----------------\n'
1849 ' | ValueError: -996\n'
1850 ' +------------------------------------\n'
1851 ' +---------------- 3 ----------------\n'
1852 ' | ValueError: -997\n'
1853 ' +------------------------------------\n'
1854 ' +---------------- 3 ----------------\n'
1855 ' | ValueError: -998\n'
1856 ' +------------------------------------\n'
1857 ' +---------------- 3 ----------------\n'
1858 ' | ValueError: -999\n'
1859 ' +------------------------------------\n')
1889 f' | ExceptionGroup: nested (2 sub-exceptions)\n'
1896 f' +-+---------------- 1 ----------------\n'
1902 f' +---------------- 2 ----------------\n'
1908 f' +------------------------------------\n')
1940 f' | ExceptionGroup: nested (2 sub-exceptions)\n'
1948 f' +-+---------------- 1 ----------------\n'
1955 f' +---------------- 2 ----------------\n'
1962 f' +------------------------------------\n')
1968 # see GH-93249
2011 # This checks built-in reporting by the interpreter.
2070 self.assertEqual(extract(limit=2), nolim[-2:])
2071 assertEqualExcept(extract(limit=100), nolim[-100:], -5-1)
2072 self.assertEqual(extract(limit=-2), nolim[:2])
2073 assertEqualExcept(extract(limit=-100), nolim[:100], len(nolim)-5-1)
2076 assertEqualExcept(extract(), nolim, -5-1)
2078 self.assertEqual(extract(), nolim[-2:])
2079 self.assertEqual(extract(limit=3), nolim[-3:])
2080 self.assertEqual(extract(limit=-3), nolim[:3])
2083 sys.tracebacklimit = -1
2099 self.assertEqual(extract(limit=-2), nolim[-2:])
2100 self.assertEqual(extract(limit=-10), nolim)
2107 self.assertEqual(extract(limit=-3), nolim[-3:])
2110 sys.tracebacklimit = -1
2118 # [1:-1] to exclude "Traceback (...)" header and
2121 return traceback.format_exception(exc_type, exc_value, tb, **kwargs)[1:-1]
2128 self.assertEqual(extract(limit=-2), nolim[-2:])
2129 self.assertEqual(extract(limit=-10), nolim)
2136 self.assertEqual(extract(limit=-3), nolim[-3:])
2139 sys.tracebacklimit = -1
2145 # Check non-printing functions in traceback module
2177 self.assertEqual(result[-2:], [
2232 self.assertEqual(len(s2) - len(s1), 1)
2468 "RecursionError: maximum recursion depth exceeded", res[-1])
2562 exc4 = traceback.TracebackException(*exc_info, limit=-1)
2563 exc5 = traceback.TracebackException(*exc_info, limit=-1, capture_locals=True)
2566 # there are locals in the next-to-innermost frame
2567 exc6 = traceback.TracebackException(*exc_info, limit=-2)
2568 exc7 = traceback.TracebackException(*exc_info, limit=-2, capture_locals=True)
2603 recurse(n-1)
2664 output.getvalue().split('\n')[-5:],
2719 expected = "ExceptionGroup: eg2 (2 sub-exceptions)\n".split('\n')
2734 f' | ExceptionGroup: eg2 (2 sub-exceptions)',
2735 f' +-+---------------- 1 ----------------',
2739 f' | ExceptionGroup: eg1 (2 sub-exceptions)',
2740 f' +-+---------------- 1 ----------------',
2748 f' +---------------- 2 ----------------',
2755 f' +------------------------------------',
2756 f' +---------------- 2 ----------------',
2763 f' +------------------------------------',
2783 f' | ExceptionGroup: eg (2 sub-exceptions)',
2784 f' +-+---------------- 1 ----------------',
2785 f' | ExceptionGroup: eg1 (3 sub-exceptions)',
2786 f' +-+---------------- 1 ----------------',
2788 f' +---------------- 2 ----------------',
2790 f' +---------------- ... ----------------',
2792 f' +------------------------------------',
2793 f' +---------------- 2 ----------------',
2794 f' | ExceptionGroup: eg2 (10 sub-exceptions)',
2795 f' +-+---------------- 1 ----------------',
2797 f' +---------------- 2 ----------------',
2799 f' +---------------- ... ----------------',
2801 f' +------------------------------------',
2809 exc = ExceptionGroup('exc', [ValueError(-i), exc, ValueError(i)])
2815 f' | ExceptionGroup: exc (3 sub-exceptions)',
2816 f' +-+---------------- 1 ----------------',
2817 f' | ValueError: -2',
2818 f' +---------------- 2 ----------------',
2819 f' | ExceptionGroup: exc (3 sub-exceptions)',
2820 f' +-+---------------- 1 ----------------',
2821 f' | ValueError: -1',
2822 f' +---------------- 2 ----------------',
2824 f' +---------------- 3 ----------------',
2826 f' +------------------------------------',
2827 f' +---------------- 3 ----------------',
2829 f' +------------------------------------',