Added ulst and uinf repr support. #133
This commit is contained in:
parent
74420e587c
commit
7ac1134872
3 changed files with 32 additions and 2 deletions
|
|
@ -1,3 +1,6 @@
|
|||
Oct 22, 2013 - v0.5.7 Super boxes constructors now take optional box list
|
||||
argument.
|
||||
|
||||
Oct 13, 2013 - v0.5.6 Fixed handling of non-ascii chars in XML boxes. Fixed
|
||||
some docstring errors in jp2box module.
|
||||
|
||||
|
|
|
|||
|
|
@ -1989,6 +1989,10 @@ class UUIDListBox(Jp2kBox):
|
|||
self.length = length
|
||||
self.offset = offset
|
||||
|
||||
def __repr__(self):
|
||||
msg = "glymur.jp2box.UUIDListBox({0})".format(self.ulst)
|
||||
return msg
|
||||
|
||||
def __str__(self):
|
||||
msg = Jp2kBox.__str__(self)
|
||||
for j, uuid_item in enumerate(self.ulst):
|
||||
|
|
@ -2040,11 +2044,15 @@ class UUIDInfoBox(Jp2kBox):
|
|||
box : list
|
||||
List of boxes contained in this superbox.
|
||||
"""
|
||||
def __init__(self, length=0, offset=-1):
|
||||
def __init__(self, box=[], length=0, offset=-1):
|
||||
Jp2kBox.__init__(self, box_id='uinf', longname='UUIDInfo')
|
||||
self.length = length
|
||||
self.offset = offset
|
||||
self.box = []
|
||||
self.box = box
|
||||
|
||||
def __repr__(self):
|
||||
msg = "glymur.jp2box.UUIDInfoBox(box={0})".format(self.box)
|
||||
return msg
|
||||
|
||||
def __str__(self):
|
||||
msg = Jp2kBox.__str__(self)
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@ import struct
|
|||
import sys
|
||||
import tempfile
|
||||
import uuid
|
||||
from uuid import UUID
|
||||
import xml.etree.cElementTree as ET
|
||||
|
||||
if sys.hexversion < 0x02070000:
|
||||
|
|
@ -839,6 +840,24 @@ class TestRepr(unittest.TestCase):
|
|||
self.assertEqual(newbox.flag, flag)
|
||||
self.assertEqual(newbox.url, url)
|
||||
|
||||
def test_uuidinfo_box(self):
|
||||
"""Verify __repr__ method on uinf box."""
|
||||
uinf = glymur.jp2box.UUIDInfoBox()
|
||||
newbox = eval(repr(uinf))
|
||||
self.assertEqual(newbox.box_id, 'uinf')
|
||||
self.assertEqual(len(newbox.box), 0)
|
||||
|
||||
def test_uuidlist_box(self):
|
||||
"""Verify __repr__ method on ulst box."""
|
||||
uuid1 = uuid.UUID('00000000-0000-0000-0000-000000000001')
|
||||
uuid2 = uuid.UUID('00000000-0000-0000-0000-000000000002')
|
||||
uuids = [uuid1, uuid2]
|
||||
ulst = glymur.jp2box.UUIDListBox(ulst=uuids)
|
||||
newbox = eval(repr(ulst))
|
||||
self.assertEqual(newbox.box_id, 'ulst')
|
||||
self.assertEqual(newbox.ulst[0], uuid1)
|
||||
self.assertEqual(newbox.ulst[1], uuid2)
|
||||
|
||||
|
||||
class TestJpxBoxes(unittest.TestCase):
|
||||
"""Tests for JPX boxes."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue