Fix and add a test for explicitly non-supported formats
This commit is contained in:
parent
633654376a
commit
e81ce6cd1a
@ -1,6 +1,21 @@
|
|||||||
#!/bin/env python3
|
#!/bin/env python3
|
||||||
|
|
||||||
# A set of extension that aren't supported, despite matching a supported mimetype
|
# A set of extension that aren't supported, despite matching a supported mimetype
|
||||||
unsupported_extensions = set(['bat', 'c', 'h', 'ksh', 'pl', 'txt', 'asc',
|
unsupported_extensions = {
|
||||||
'text', 'pot', 'brf', 'srt', 'rdf', 'wsdl',
|
'.asc',
|
||||||
'xpdl', 'xsl', 'xsd'])
|
'.bat',
|
||||||
|
'.brf',
|
||||||
|
'.c',
|
||||||
|
'.h',
|
||||||
|
'.ksh',
|
||||||
|
'.pl',
|
||||||
|
'.pot',
|
||||||
|
'.rdf',
|
||||||
|
'.srt',
|
||||||
|
'.text',
|
||||||
|
'.txt',
|
||||||
|
'.wsdl',
|
||||||
|
'.xpdl',
|
||||||
|
'.xsd',
|
||||||
|
'.xsl',
|
||||||
|
}
|
||||||
|
@ -35,6 +35,14 @@ class TestUnsupportedFiles(unittest.TestCase):
|
|||||||
self.assertEqual(parser, None)
|
self.assertEqual(parser, None)
|
||||||
os.remove('./tests/clean.py')
|
os.remove('./tests/clean.py')
|
||||||
|
|
||||||
|
class TestExplicitelyUnsupportedFiles(unittest.TestCase):
|
||||||
|
def test_pdf(self):
|
||||||
|
shutil.copy('./tests/test_libmat2.py', './tests/clean.txt')
|
||||||
|
parser, mimetype = parser_factory.get_parser('./tests/data/clean.txt')
|
||||||
|
self.assertEqual(mimetype, 'text/plain')
|
||||||
|
self.assertEqual(parser, None)
|
||||||
|
os.remove('./tests/clean.txt')
|
||||||
|
|
||||||
|
|
||||||
class TestCorruptedFiles(unittest.TestCase):
|
class TestCorruptedFiles(unittest.TestCase):
|
||||||
def test_pdf(self):
|
def test_pdf(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user