summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjvoisin2018-06-10 00:28:43 +0200
committerjvoisin2018-06-10 00:28:43 +0200
commite81ce6cd1aadc382b37a428d3e030fc33f4464c5 (patch)
tree2f6168a4a641695e0b61b66a6a30e95b2c625ee6
parent633654376ab3821b7b65f4bb44fc00bcc1e9e8fb (diff)
Fix and add a test for explicitly non-supported formats
-rw-r--r--libmat2/__init__.py21
-rw-r--r--tests/test_libmat2.py8
2 files changed, 26 insertions, 3 deletions
diff --git a/libmat2/__init__.py b/libmat2/__init__.py
index 07d3036..91a51d8 100644
--- a/libmat2/__init__.py
+++ b/libmat2/__init__.py
@@ -1,6 +1,21 @@
1#!/bin/env python3 1#!/bin/env python3
2 2
3# A set of extension that aren't supported, despite matching a supported mimetype 3# A set of extension that aren't supported, despite matching a supported mimetype
4unsupported_extensions = set(['bat', 'c', 'h', 'ksh', 'pl', 'txt', 'asc', 4unsupported_extensions = {
5 'text', 'pot', 'brf', 'srt', 'rdf', 'wsdl', 5 '.asc',
6 'xpdl', 'xsl', 'xsd']) 6 '.bat',
7 '.brf',
8 '.c',
9 '.h',
10 '.ksh',
11 '.pl',
12 '.pot',
13 '.rdf',
14 '.srt',
15 '.text',
16 '.txt',
17 '.wsdl',
18 '.xpdl',
19 '.xsd',
20 '.xsl',
21 }
diff --git a/tests/test_libmat2.py b/tests/test_libmat2.py
index 84eb75e..3d08dea 100644
--- a/tests/test_libmat2.py
+++ b/tests/test_libmat2.py
@@ -35,6 +35,14 @@ class TestUnsupportedFiles(unittest.TestCase):
35 self.assertEqual(parser, None) 35 self.assertEqual(parser, None)
36 os.remove('./tests/clean.py') 36 os.remove('./tests/clean.py')
37 37
38class TestExplicitelyUnsupportedFiles(unittest.TestCase):
39 def test_pdf(self):
40 shutil.copy('./tests/test_libmat2.py', './tests/clean.txt')
41 parser, mimetype = parser_factory.get_parser('./tests/data/clean.txt')
42 self.assertEqual(mimetype, 'text/plain')
43 self.assertEqual(parser, None)
44 os.remove('./tests/clean.txt')
45
38 46
39class TestCorruptedFiles(unittest.TestCase): 47class TestCorruptedFiles(unittest.TestCase):
40 def test_pdf(self): 48 def test_pdf(self):