summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2017-12-04 10:50:31 -0800
committerAdam Hupp <adam@hupp.org>2017-12-04 10:50:31 -0800
commit10e20995b5f4b8f8131b7e69912882bb81393cb2 (patch)
treec5b2ba87bc64bf58b09b22fc136d635bad7d3ca9 /test
parent9ae12462c15100941435acf4eb9caaf5de5dddf9 (diff)
downloadpython-magic-10e20995b5f4b8f8131b7e69912882bb81393cb2.tar.gz
add from_open_file to match libmagic binding featureset
Diffstat (limited to 'test')
-rwxr-xr-xtest/test.py6
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'))