summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rwxr-xr-xtest/test.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/test.py b/test/test.py
index 03914ff..5eaaa0d 100755
--- a/test/test.py
+++ b/test/test.py
@@ -92,5 +92,16 @@ class MagicTest(unittest.TestCase):
m = magic.Magic(mime=True, keep_going=True)
self.assertEqual(m.from_file(filename), 'image/jpeg'.encode('utf-8'))
+
+ def test_rethrow(self):
+ old = magic.magic_buffer
+ try:
+ def t(x,y):
+ raise magic.MagicException("passthrough")
+ magic.magic_buffer = t
+
+ self.assertRaises(magic.MagicException, magic.from_buffer, "hello", True)
+ finally:
+ magic.magic_buffer = old
if __name__ == '__main__':
unittest.main()