diff options
| author | Adam Hupp <adam@hupp.org> | 2016-06-05 15:53:16 -0700 |
|---|---|---|
| committer | Adam Hupp <adam@hupp.org> | 2016-06-05 15:53:16 -0700 |
| commit | b1666986236eab820e9155a5943d6b94938b4c40 (patch) | |
| tree | 7d0be8a117e5d23f66fbbc78afed9995c99799a0 /test | |
| parent | f82dc97ab906e2e83a26085834fa5fe7696972e8 (diff) | |
| download | python-magic-b1666986236eab820e9155a5943d6b94938b4c40.tar.gz | |
Return str rather than bytes for the description strings on python3.
Assumes utf-8 encoding from magic return values, which I hope is
always the case.
Diffstat (limited to 'test')
| -rwxr-xr-x | test/test.py | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/test/test.py b/test/test.py index 5eaaa0d..ed3f46b 100755 --- a/test/test.py +++ b/test/test.py @@ -22,13 +22,11 @@ class MagicTest(unittest.TestCase): expected_value = (expected_value,) for i in expected_value: - expected_value_bytes = i.encode('utf-8') - with open(filename, 'rb') as f: buf_value = m.from_buffer(f.read()) file_value = m.from_file(filename) - if buf_value == expected_value_bytes and file_value == expected_value_bytes: + if buf_value == i and file_value == i: break else: self.assertTrue(False, "no match for " + repr(expected_value)) @@ -86,11 +84,10 @@ class MagicTest(unittest.TestCase): filename = os.path.join(self.TESTDATA_DIR, 'keep-going.jpg') m = magic.Magic(mime=True) - self.assertEqual(m.from_file(filename), - 'image/jpeg'.encode('utf-8')) + self.assertEqual(m.from_file(filename), 'image/jpeg') m = magic.Magic(mime=True, keep_going=True) - self.assertEqual(m.from_file(filename), 'image/jpeg'.encode('utf-8')) + self.assertEqual(m.from_file(filename), 'image/jpeg') def test_rethrow(self): |
