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

Method test_reading

Lib/test/test_importlib/resources/test_path.py:16–24  ·  view source on GitHub ↗

Path should be readable and a pathlib.Path instance.

(self)

Source from the content-addressed store, hash-verified

14
15class PathTests:
16 def test_reading(self):
17 """
18 Path should be readable and a pathlib.Path instance.
19 """
20 target = resources.files(self.data) / 'utf-8.file'
21 with resources.as_file(target) as path:
22 self.assertIsInstance(path, pathlib.Path)
23 self.assertEndsWith(path.name, "utf-8.file")
24 self.assertEqual('Hello, UTF-8 world!\n', path.read_text(encoding='utf-8'))
25
26
27class PathDiskTests(PathTests, util.DiskSetup, unittest.TestCase):

Callers

nothing calls this directly

Calls 5

assertIsInstanceMethod · 0.80
assertEndsWithMethod · 0.80
filesMethod · 0.45
assertEqualMethod · 0.45
read_textMethod · 0.45

Tested by

no test coverage detected