Пример #1
0
 def test_valid_file_in_directory(self):
     zip_file = ZipFile(io.BytesIO(), 'a')
     zip_file.writestr('test/test.txt', 'testdata')
     paths = TruegazeUtils.get_matching_paths_from_zip(
         zip_file, re.compile(r'.*est.*\.txt'))
     assert len(paths) == 1
     assert paths[0] == 'test/test.txt'
Пример #2
0
 def test_valid_one_file(self):
     zip_file = ZipFile(io.BytesIO(), 'a')
     zip_file.writestr('test', '')
     paths = TruegazeUtils.get_matching_paths_from_zip(
         zip_file, re.compile(r'.*'))
     assert len(paths) == 1
     assert paths[0] == 'test'
Пример #3
0
 def test_valid_three_files(self):
     zip_file = ZipFile(io.BytesIO(), 'a')
     zip_file.writestr('test1.txt', '')
     zip_file.writestr('test/test2.doc', '')
     zip_file.writestr('test/test/test3.md', '')
     paths = TruegazeUtils.get_matching_paths_from_zip(
         zip_file, re.compile(r'.*est/test.*\..*'))
     assert len(paths) == 2
     assert paths[0] == 'test/test2.doc'
     assert paths[1] == 'test/test/test3.md'
Пример #4
0
 def get_paths(zip_file):
     return TruegazeUtils.get_matching_paths_from_zip(
         zip_file, CONFIG_FILE_PATTERN)
Пример #5
0
 def test_empty(self):
     zip_file = ZipFile(io.BytesIO(), 'a')
     paths = TruegazeUtils.get_matching_paths_from_zip(
         zip_file, re.compile(r'.*'))
     assert len(paths) == 0