From db92f3fea774a425bc5f85402bdf4fc6ee81c177 Mon Sep 17 00:00:00 2001 From: John Evans Date: Wed, 12 Feb 2014 09:17:17 -0500 Subject: [PATCH] rreq masks and standard features now printed together. #174 Masks are printed in hex. --- glymur/jp2box.py | 18 ++++++------------ glymur/test/fixtures.py | 14 +++++--------- glymur/test/test_printing.py | 6 +++--- 3 files changed, 14 insertions(+), 24 deletions(-) diff --git a/glymur/jp2box.py b/glymur/jp2box.py index 03adce0..d5e79e1 100644 --- a/glymur/jp2box.py +++ b/glymur/jp2box.py @@ -11,7 +11,7 @@ References Extensions """ -# pylint: disable=C0302,R0903,R0913 +# pylint: disable=C0302,R0903,R0913,W0142 from collections import OrderedDict import datetime @@ -1866,20 +1866,14 @@ class ReaderRequirementsBox(Jp2kBox): if _printoptions['short'] == True: return msg - msg += '\n Fully Understands Aspect Mask: {0}'.format(self.fuam) - msg += '\n Display Completely Mask: {0}'.format(self.dcm) + msg += '\n Fully Understands Aspect Mask: 0x{0:x}'.format(self.fuam) + msg += '\n Display Completely Mask: 0x{0:x}'.format(self.dcm) msg += '\n Standard Features and Masks:' for j in range(len(self.standard_flag)): - sfl = self.standard_flag[j] - mask = self.standard_mask[j] - msg += '\n Feature {0:03d}: {1}'.format(sfl, mask) - - msg += '\n Standard Features:' - for j in range(len(self.standard_flag)): - sfl = self.standard_flag[j] - rrdisp = _READER_REQUIREMENTS_DISPLAY[self.standard_flag[j]] - msg += '\n Feature {0:03d}: {1}'.format(sfl, rrdisp) + args = (self.standard_flag[j], self.standard_mask[j], + _READER_REQUIREMENTS_DISPLAY[self.standard_flag[j]]) + msg += '\n Feature {0:03d}: 0x{1:x} {2}'.format(*args) msg += '\n Vendor Features:' for j in range(len(self.vendor_feature)): diff --git a/glymur/test/fixtures.py b/glymur/test/fixtures.py index 9b40a25..6e0a76c 100644 --- a/glymur/test/fixtures.py +++ b/glymur/test/fixtures.py @@ -683,14 +683,10 @@ Contiguous Codestream Box (jp2c) @ (3223, 1132296)""" # Output of reader requirement printing for file7.jp2 file7_rreq = r"""Reader Requirements Box (rreq) @ (44, 24) - Fully Understands Aspect Mask: 160 - Display Completely Mask: 192 + Fully Understands Aspect Mask: 0xa0 + Display Completely Mask: 0xc0 Standard Features and Masks: - Feature 005: 128 - Feature 060: 96 - Feature 043: 64 - Standard Features: - Feature 005: Unrestricted JPEG 2000 Part 1 codestream, ITU-T Rec. T.800 | ISO/IEC 15444-1 - Feature 060: e-sRGB enumerated colorspace - Feature 043: Deprecated - compositing layer uses restricted ICC profile + Feature 005: 0x80 Unrestricted JPEG 2000 Part 1 codestream, ITU-T Rec. T.800 | ISO/IEC 15444-1 + Feature 060: 0x60 e-sRGB enumerated colorspace + Feature 043: 0x40 Deprecated - compositing layer uses restricted ICC profile Vendor Features:""" diff --git a/glymur/test/test_printing.py b/glymur/test/test_printing.py index 26156dc..5fe3322 100644 --- a/glymur/test/test_printing.py +++ b/glymur/test/test_printing.py @@ -53,7 +53,7 @@ class TestPrinting(unittest.TestCase): with self.assertRaises(TypeError): glymur.set_printoptions(hi='low') - def test_printopt_no_codestr_then_no_xml(self): + def test_propts_no_codestream_then_no_xml(self): """Verify printed output when codestream=False and xml=False, #162""" # The print options should be persistent across invocations. glymur.set_printoptions(codestream=False) @@ -629,7 +629,7 @@ class TestPrinting(unittest.TestCase): def test_xml_latin1(self): """Should be able to print an XMLBox with utf-8 encoding (latin1).""" # Seems to be inconsistencies between different versions of python2.x - # as to what gets printed. + # as to what gets printed. # # 2.7.5 (fedora 19) prints xml entities. # 2.7.3 seems to want to print hex escapes. @@ -658,7 +658,7 @@ class TestPrinting(unittest.TestCase): def test_xml_cyrrilic(self): """Should be able to print an XMLBox with utf-8 encoding (cyrrillic).""" # Seems to be inconsistencies between different versions of python2.x - # as to what gets printed. + # as to what gets printed. # # 2.7.5 (fedora 19) prints xml entities. # 2.7.3 seems to want to print hex escapes.