Added __repr__ for JPEG2000SignatureBox, FileTypeBox.
This commit is contained in:
parent
016443faef
commit
368c355560
2 changed files with 21 additions and 0 deletions
|
|
@ -801,6 +801,13 @@ class FileTypeBox(Jp2kBox):
|
|||
self.length = length
|
||||
self.offset = offset
|
||||
|
||||
def __repr__(self):
|
||||
msg = "glymur.jp2box.FileTypeBox(brand='{0}', minor_version={1}, "
|
||||
msg += "compatibility_list={2})"
|
||||
msg = msg.format(self.brand, self.minor_version,
|
||||
self.compatibility_list)
|
||||
return msg
|
||||
|
||||
def __str__(self):
|
||||
lst = [Jp2kBox.__str__(self),
|
||||
' Brand: {0}',
|
||||
|
|
@ -1141,6 +1148,9 @@ class JPEG2000SignatureBox(Jp2kBox):
|
|||
self.length = length
|
||||
self.offset = offset
|
||||
|
||||
def __repr__(self):
|
||||
return 'glymur.jp2box.JPEG2000SignatureBox()'
|
||||
|
||||
def __str__(self):
|
||||
msg = Jp2kBox.__str__(self)
|
||||
msg += '\n Signature: {0:02x}{1:02x}{2:02x}{3:02x}'
|
||||
|
|
|
|||
|
|
@ -677,6 +677,10 @@ class TestJp2Boxes(unittest.TestCase):
|
|||
jp2k = glymur.jp2box.JPEG2000SignatureBox()
|
||||
self.assertEqual(jp2k.signature, (13, 10, 135, 10))
|
||||
|
||||
# Test the representation instantiation.
|
||||
newbox = eval(repr(jp2k))
|
||||
self.assertTrue(isinstance(newbox, glymur.jp2box.JPEG2000SignatureBox))
|
||||
|
||||
def test_default_ftyp(self):
|
||||
"""Should be able to instantiate a FileTypeBox"""
|
||||
ftyp = glymur.jp2box.FileTypeBox()
|
||||
|
|
@ -684,6 +688,13 @@ class TestJp2Boxes(unittest.TestCase):
|
|||
self.assertEqual(ftyp.minor_version, 0)
|
||||
self.assertEqual(ftyp.compatibility_list, ['jp2 '])
|
||||
|
||||
# Test the representation instantiation.
|
||||
newbox = eval(repr(ftyp))
|
||||
self.assertTrue(isinstance(newbox, glymur.jp2box.FileTypeBox))
|
||||
self.assertEqual(newbox.brand, 'jp2 ')
|
||||
self.assertEqual(newbox.minor_version, 0)
|
||||
self.assertEqual(newbox.compatibility_list, ['jp2 '])
|
||||
|
||||
def test_default_ihdr(self):
|
||||
"""Should be able to instantiate an image header box."""
|
||||
ihdr = glymur.jp2box.ImageHeaderBox(height=512, width=256,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue