summaryrefslogtreecommitdiff
path: root/test/test.py
diff options
context:
space:
mode:
authorAdam Hupp <adam@hupp.org>2016-06-05 15:28:20 -0700
committerAdam Hupp <adam@hupp.org>2016-06-05 15:28:44 -0700
commitf82dc97ab906e2e83a26085834fa5fe7696972e8 (patch)
treee5b445c7c1bcbdf55b91b404f2ccd19a74260ff8 /test/test.py
parentc64acb4f8c21bf47ca98f9dce42217154b485f2f (diff)
downloadpython-magic-f82dc97ab906e2e83a26085834fa5fe7696972e8.tar.gz
propagate exception in other branch of 509 hack
Diffstat (limited to 'test/test.py')
-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()