python-python-magic/magic-new-mime.patch
Tomáš Chvátal 070d16a1c8 - Version update to 0.4.15:
* Few test tweaks
- Enable tests
- Add patch to fix gzip detection in tests:
  * magic-tests.patch
- Add patch to fix working with new file:
  * magic-new-file.patch
- Add patch to work with new mimedb:
  * magic-new-mime.patch
- Add patch magic-pep8.patch to have other patches apply cleanly

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-python-magic?expand=0&rev=9
2018-08-21 10:50:28 +00:00

53 lines
1.8 KiB
Diff

From 4bda684f8b461cc1f69593799efcf6afe8397756 Mon Sep 17 00:00:00 2001
From: Adam Hupp <adam@hupp.org>
Date: Sat, 9 Dec 2017 09:09:00 -0800
Subject: [PATCH] fix test for xenial since travis started enabling it
---
test/test.py | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/test/test.py b/test/test.py
index addccc6..c6e2d9c 100755
--- a/test/test.py
+++ b/test/test.py
@@ -17,7 +17,7 @@ def assert_values(self, m, expected_values):
except TypeError:
filename = os.path.join(self.TESTDATA_DIR.encode('utf-8'), filename)
-
+
if type(expected_value) is not tuple:
expected_value = (expected_value,)
@@ -37,7 +37,7 @@ def test_from_buffer_str_and_bytes(self):
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'))
shutil.copyfile(os.path.join(MagicTest.TESTDATA_DIR, 'lambda'), dest)
@@ -92,9 +92,9 @@ def test_keep_going(self):
m = magic.Magic(mime=True)
self.assertEqual(m.from_file(filename), 'image/jpeg')
-
+
m = magic.Magic(mime=True, keep_going=True)
- self.assertEqual(m.from_file(filename), 'image/jpeg')
+ self.assertEqual(m.from_file(filename), 'image/jpeg\\012- application/octet-stream')
def test_rethrow(self):
@@ -103,7 +103,7 @@ def test_rethrow(self):
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