diff options
| author | Adam Hupp <adam@hupp.org> | 2020-01-24 21:20:11 -0800 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2020-01-24 21:23:05 -0800 |
| commit | 0e977c98649b4ed4533a7700fbc5fea6895bfe71 (patch) | |
| tree | 23746920d0aec60d7c7849dbcc494a78c8a09c5f | |
| parent | 2d63bfa6f929857f9f3005b9552517d0f22adc47 (diff) | |
| download | python-magic-0e977c98649b4ed4533a7700fbc5fea6895bfe71.tar.gz | |
Expose magic_version as magic.version(), which returns an integer representing the version number.
re: https://github.com/ahupp/python-magic/issues/204
| -rw-r--r-- | magic.py | 6 | ||||
| -rwxr-xr-x | test/test.py | 3 |
2 files changed, 9 insertions, 0 deletions
@@ -322,6 +322,12 @@ def magic_getparam(cookie, param): _magic_getparam(cookie, param, byref(val)) return val.value +magic_version = libmagic.magic_version +magic_version.restype = c_int +magic_version.argtypes = [] + +def version(): + return magic_version() MAGIC_NONE = 0x000000 # No flags MAGIC_DEBUG = 0x000001 # Turn on debugging diff --git a/test/test.py b/test/test.py index c6ba522..d067b15 100755 --- a/test/test.py +++ b/test/test.py @@ -11,6 +11,9 @@ import sys class MagicTest(unittest.TestCase): TESTDATA_DIR = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'testdata') + def test_version(self): + self.assertTrue(magic.version() > 0) + def test_fs_encoding(self): self.assertEqual('utf-8', sys.getfilesystemencoding().lower()) |
