From 2d06f30825b58ce595469f6e27f9ad32d7e4e4ad Mon Sep 17 00:00:00 2001 From: mavaylon1 Date: Mon, 29 Jan 2024 10:21:37 -0800 Subject: [PATCH] test --- src/hdmf/common/resources.py | 8 +++++--- tests/unit/common/test_resources.py | 4 ++-- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/src/hdmf/common/resources.py b/src/hdmf/common/resources.py index d882208a7..fdca4bb81 100644 --- a/src/hdmf/common/resources.py +++ b/src/hdmf/common/resources.py @@ -989,11 +989,13 @@ def to_zip(self, **kwargs): for file in files: os.remove(file) - def _get_zip_directory(self, file_path): + @classmethod + @docval({'name': 'path', 'type': str, 'doc': 'The path to the zip file.'}) + def get_zip_directory(cls, path): """ Return the directory of the file given. """ - directory = os.path.dirname(os.path.realpath(file_path)) + directory = os.path.dirname(os.path.realpath(path)) return directory @classmethod @@ -1003,7 +1005,7 @@ def from_zip(cls, **kwargs): Method to read in zipped tsv files to populate HERD. """ zip_file = kwargs['path'] - directory = self._get_zip_directory(zip_file) + directory = cls.get_zip_directory(zip_file) with zipfile.ZipFile(zip_file, 'r') as zip: zip.extractall(directory) diff --git a/tests/unit/common/test_resources.py b/tests/unit/common/test_resources.py index c567d4aa8..0de6ba644 100644 --- a/tests/unit/common/test_resources.py +++ b/tests/unit/common/test_resources.py @@ -750,8 +750,8 @@ def test_get_zip_directory(self): er.to_zip(path='./HERD.zip') er.to_zip(path='HERD2.zip') - d1 = er._get_zip_directory('./HERD.zip') - d2 = er._get_zip_directory('HERD2.zip') + d1 = er.get_zip_directory('./HERD.zip') + d2 = er.get_zip_directory('HERD2.zip') self.assertEqual(d1,d2)