diff options
Diffstat (limited to 'Lib/test/test_importlib/test_path.py')
-rw-r--r-- | Lib/test/test_importlib/test_path.py | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_importlib/test_path.py b/Lib/test/test_importlib/test_path.py index abf8086..2110770 100644 --- a/Lib/test/test_importlib/test_path.py +++ b/Lib/test/test_importlib/test_path.py @@ -1,3 +1,4 @@ +import io import unittest from importlib import resources @@ -37,6 +38,17 @@ class PathDiskTests(PathTests, unittest.TestCase): assert 'data' in str(path) +class PathMemoryTests(PathTests, unittest.TestCase): + def setUp(self): + file = io.BytesIO(b'Hello, UTF-8 world!\n') + self.addCleanup(file.close) + self.data = util.create_package( + file=file, path=FileNotFoundError("package exists only in memory") + ) + self.data.__spec__.origin = None + self.data.__spec__.has_location = False + + class PathZipTests(PathTests, util.ZipSetup, unittest.TestCase): def test_remove_in_context_manager(self): # It is not an error if the file that was temporarily stashed on the |