Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
mavaylon1 committed Jan 29, 2024
1 parent 198d7df commit 2d06f30
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
8 changes: 5 additions & 3 deletions src/hdmf/common/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/common/test_resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 2d06f30

Please sign in to comment.