diff --git a/glymur/jp2box.py b/glymur/jp2box.py index 851ae3b..b2986ae 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -1241,8 +1241,10 @@ class FileTypeBox(Jp2kBox): def _validate(self, writing=False): """Validate the box before writing to file.""" if self.brand not in ['jp2 ', 'jpx ']: - msg = "The file type brand must be either 'jp2 ' or 'jpx '." - self._dispatch_validation_error(msg, writing=writing) + msg = "The file type brand was '{0}'. " + msg += "It should be either 'jp2 ' or 'jpx '." + self._dispatch_validation_error(msg.format(self.brand), + writing=writing) valid_cls = ['jp2 ', 'jpx ', 'jpxb'] for item in self.compatibility_list: if item not in valid_cls: diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 05d4ccc..aba1463 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -814,9 +814,9 @@ class TestJp2kOpjDataRootWarnings(unittest.TestCase): """Should warn in case of bad ftyp brand.""" filename = opj_data_file('input/nonregression/edf_c2_1000290.jp2') with warnings.catch_warnings(record=True) as w: - warnings.simplefilter('always') - jp2 = Jp2k(filename) - self.assertTrue(issubclass(w[0].category, UserWarning)) + warnings.simplefilter('always') + jp2 = Jp2k(filename) + self.assertTrue(issubclass(w[0].category, UserWarning)) def test_invalid_approximation(self): """Should warn in case of invalid approximation."""