Skip to content

Commit

Permalink
Test zip data for path()
Browse files Browse the repository at this point in the history
  • Loading branch information
brettcannon committed Oct 27, 2017
1 parent 6ac5da6 commit 6daf3d4
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions importlib_resources/tests/test_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,23 @@ def execute(self, package, path):
pass


class PathTests(unittest.TestCase):
class PathTests:

def test_reading(self):
# Path should be readable.
# Test also implicitly verifies the returned object is a pathlib.Path
# instance.
with resources.path(data, 'utf-8.file') as path:
with resources.path(self.data, 'utf-8.file') as path:
# pathlib.Path.read_text() was introduced in Python 3.5.
with path.open('r', encoding='utf-8') as file:
text = file.read()
self.assertEqual('Hello, UTF-8 world!\n', text)


class PathDiskTests(PathTests, unittest.TestCase):

data = data


class PathZipTests(PathTests, util.ZipSetup, unittest.TestCase):
pass

0 comments on commit 6daf3d4

Please sign in to comment.