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

Method _apply_failure

Lib/test/test_unicode_file_functions.py:86–95  ·  view source on GitHub ↗
(self, fn, filename,
                       expected_exception=FileNotFoundError,
                       check_filename=True)

Source from the content-addressed store, hash-verified

84 return s
85
86 def _apply_failure(self, fn, filename,
87 expected_exception=FileNotFoundError,
88 check_filename=True):
89 with self.assertRaises(expected_exception) as c:
90 fn(filename)
91 exc_filename = c.exception.filename
92 if check_filename:
93 self.assertEqual(exc_filename, filename, "Function '%s(%a) failed "
94 "with bad filename in the exception: %a" %
95 (fn.__name__, filename, exc_filename))
96
97 def test_failures(self):
98 # Pass non-existing Unicode filenames all over the place.

Callers 3

test_failuresMethod · 0.95
test_openMethod · 0.95
test_normalizeMethod · 0.95

Calls 3

fnFunction · 0.85
assertRaisesMethod · 0.45
assertEqualMethod · 0.45

Tested by

no test coverage detected