Added rreg repr support. #133

This commit is contained in:
John Evans 2013-10-27 06:09:39 -04:00
commit 9caf5c9f08
2 changed files with 28 additions and 0 deletions

View file

@ -1506,6 +1506,18 @@ class ReaderRequirementsBox(Jp2kBox):
self.length = length
self.offset = offset
def __repr__(self):
msg = "glymur.jp2box.ReaderRequirementsBox(fuam={fuam}, dcm={dcm}, "
msg += "standard_flag={standard_flag}, standard_mask={standard_mask}, "
msg += "vendor_feature={vendor_feature}, vendor_mask={vendor_mask})"
msg = msg.format(fuam=self.fuam,
dcm=self.dcm,
standard_flag=self.standard_flag,
standard_mask=self.standard_mask,
vendor_feature=self.vendor_feature,
vendor_mask=self.vendor_mask)
return msg
def __str__(self):
msg = Jp2kBox.__str__(self)

View file

@ -903,6 +903,22 @@ class TestRepr(unittest.TestCase):
else:
self.assertRegex(repr(box), regexp)
def test_readerrequirements_box(self):
"""Verify rreq repr method."""
box = glymur.jp2box.ReaderRequirementsBox(fuam=160, dcm=192,
standard_flag=(5, 61, 43),
standard_mask=(128, 96, 64),
vendor_feature=[],
vendor_mask=[])
newbox = eval(repr(box))
self.assertEqual(box.fuam, newbox.fuam)
self.assertEqual(box.dcm, newbox.dcm)
self.assertEqual(box.standard_flag, newbox.standard_flag)
self.assertEqual(box.standard_mask, newbox.standard_mask)
self.assertEqual(box.vendor_feature, newbox.vendor_feature)
self.assertEqual(box.vendor_mask, newbox.vendor_mask)
class TestJpxBoxes(unittest.TestCase):
"""Tests for JPX boxes."""