summaryrefslogtreecommitdiff
path: root/test/test.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test.py')
-rwxr-xr-xtest/test.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/test.py b/test/test.py
index 6ae5c07..78ddb2b 100755
--- a/test/test.py
+++ b/test/test.py
@@ -30,6 +30,13 @@ class MagicTest(unittest.TestCase):
break
else:
self.assertTrue(False, "no match for " + repr(expected_value))
+
+ def test_from_buffer_str_and_bytes(self):
+ m = magic.Magic(mime=True)
+ s = '#!/usr/bin/env python\nprint("foo")'
+ self.assertEqual("text/x-python", m.from_buffer(s))
+ b = b'#!/usr/bin/env python\nprint("foo")'
+ self.assertEqual("text/x-python", m.from_buffer(b))
def test_mime_types(self):
dest = os.path.join(MagicTest.TESTDATA_DIR, b'\xce\xbb'.decode('utf-8'))