MCPcopy Index your code
hub / github.com/python/cpython / _assertMatchOK

Method _assertMatchOK

Lib/test/test_pyrepl/test_pyrepl.py:1912–1925  ·  view source on GitHub ↗
(
            self, var: str, expected: str | re.Pattern, actual: str
    )

Source from the content-addressed store, hash-verified

1910 self.assertTrue(case1 or case2 or case3 or case4, output)
1911
1912 def _assertMatchOK(
1913 self, var: str, expected: str | re.Pattern, actual: str
1914 ) -> None:
1915 if isinstance(expected, re.Pattern):
1916 self.assertTrue(
1917 expected.match(actual),
1918 f"{var}={actual} does not match {expected.pattern}",
1919 )
1920 else:
1921 self.assertEqual(
1922 actual,
1923 expected,
1924 f"expected {var}={expected}, got {var}={actual}",
1925 )
1926
1927 @force_not_colorized
1928 def _run_repl_globals_test(self, expectations, *, as_file=False, as_module=False, pythonstartup=False):

Callers 1

Calls 3

assertTrueMethod · 0.80
matchMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected