Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def check_get_extractors(self, test_file, expected, kinds=()):
from extractcode import archive
test_loc = self.get_test_loc(test_file)
if kinds:
extractors = archive.get_extractors(test_loc, kinds)
else:
extractors = archive.get_extractors(test_loc)
# import typecode
# ft = 'TODO' or typecode.contenttype.get_type(test_loc).filetype_file
# mt = 'TODO' or typecode.contenttype.get_type(test_loc).mimetype_file
fe = fileutils.file_extension(test_loc).lower()
em = ', '.join(e.__module__ + '.' + e.__name__ for e in extractors)
msg = ('%(expected)r == %(extractors)r for %(test_file)s\n'
'with fe:%(fe)r, em:%(em)s' % locals())
assert expected == extractors, msg
def test_file_extension_on_path_and_location_6(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/f.a'
expected_name = '.a'
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_5(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/b/'
expected_name = ''
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_8(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'f.a/a.c'
expected_name = '.c'
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_2(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/.a/'
expected_name = ''
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_3(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/b/.a.b'
expected_name = '.b'
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_1(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/.a/file'
expected_name = ''
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_4(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/b/a.tag.gz'
expected_name = '.gz'
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_3(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/b/.a.b'
expected_name = '.b'
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result
def test_file_extension_on_path_and_location_1(self):
test_dir = self.get_test_loc('fileutils/basename')
test_file = 'a/.a/file'
expected_name = ''
result = fileutils.file_extension(test_file)
assert expected_name == result
result = fileutils.file_extension((os.path.join(test_dir, test_file)))
assert expected_name == result