diff options
| author | Adam Hupp <adam@hupp.org> | 2017-12-04 10:50:31 -0800 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2017-12-04 10:50:31 -0800 |
| commit | 10e20995b5f4b8f8131b7e69912882bb81393cb2 (patch) | |
| tree | c5b2ba87bc64bf58b09b22fc136d635bad7d3ca9 /test | |
| parent | 9ae12462c15100941435acf4eb9caaf5de5dddf9 (diff) | |
| download | python-magic-10e20995b5f4b8f8131b7e69912882bb81393cb2.tar.gz | |
add from_open_file to match libmagic binding featureset
Diffstat (limited to 'test')
| -rwxr-xr-x | test/test.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/test/test.py b/test/test.py index 3097e6e..2865a66 100755 --- a/test/test.py +++ b/test/test.py @@ -74,6 +74,12 @@ class MagicTest(unittest.TestCase): in ("text/x-python", "text/x-script.python")) + + def test_open_file(self): + m = magic.Magic(mime=True) + with open(os.path.join(self.TESTDATA_DIR, "test.pdf")) as f: + self.assertEqual("application/pdf", m.from_open_file(f)) + def test_mime_types(self): dest = os.path.join(MagicTest.TESTDATA_DIR, b'\xce\xbb'.decode('utf-8')) |
