pep8 work.

This commit is contained in:
John Evans 2013-06-27 16:35:55 -04:00
commit 62e7afa118
5 changed files with 25 additions and 18 deletions

View file

@ -119,7 +119,6 @@ and add it after the JP2 header box, but before the codestream box ::
. (truncated) . (truncated)
. .
Work with XMP UUIDs? Work with XMP UUIDs?
==================== ====================
The example JP2 file shipped with glymur has an XMP UUID. :: The example JP2 file shipped with glymur has an XMP UUID. ::

View file

@ -20,6 +20,7 @@ def nemo():
file = pkg_resources.resource_filename(__name__, "nemo.jp2") file = pkg_resources.resource_filename(__name__, "nemo.jp2")
return file return file
def goodstuff(): def goodstuff():
"""Shortcut for specifying path to goodstuff.j2k. """Shortcut for specifying path to goodstuff.j2k.

View file

@ -27,12 +27,12 @@ class TestChannelDefinition(unittest.TestCase):
# Write the first component back out to file. # Write the first component back out to file.
with tempfile.NamedTemporaryFile(suffix=".j2k", delete=False) as tfile: with tempfile.NamedTemporaryFile(suffix=".j2k", delete=False) as tfile:
grey_j2k = Jp2k(tfile.name, 'wb') grey_j2k = Jp2k(tfile.name, 'wb')
grey_j2k.write(data[:,:,0]) grey_j2k.write(data[:, :, 0])
cls.one_plane = tfile.name cls.one_plane = tfile.name
# Write the first two components back out to file. # Write the first two components back out to file.
with tempfile.NamedTemporaryFile(suffix=".j2k", delete=False) as tfile: with tempfile.NamedTemporaryFile(suffix=".j2k", delete=False) as tfile:
grey_j2k = Jp2k(tfile.name, 'wb') grey_j2k = Jp2k(tfile.name, 'wb')
grey_j2k.write(data[:,:,0:1]) grey_j2k.write(data[:, :, 0:1])
cls.two_planes = tfile.name cls.two_planes = tfile.name
# Write four components back out to file. # Write four components back out to file.
with tempfile.NamedTemporaryFile(suffix=".j2k", delete=False) as tfile: with tempfile.NamedTemporaryFile(suffix=".j2k", delete=False) as tfile:
@ -228,6 +228,7 @@ class TestChannelDefinition(unittest.TestCase):
channel_type=[0, 0], channel_type=[0, 0],
association=[1, 2, 3]) association=[1, 2, 3])
class TestXML(unittest.TestCase): class TestXML(unittest.TestCase):
def setUp(self): def setUp(self):
@ -497,6 +498,13 @@ class TestJp2Boxes(unittest.TestCase):
j2k.wrap(tfile.name) j2k.wrap(tfile.name)
self.verify_wrapped_raw(tfile.name) self.verify_wrapped_raw(tfile.name)
def test_wrap_jp2(self):
j2k = Jp2k(self.j2kfile)
with tempfile.NamedTemporaryFile(suffix=".jp2") as tfile:
jp2 = j2k.wrap(tfile.name)
boxes = [box.id for box in jp2.box]
self.assertEqual(boxes, ['jP ', 'ftyp', 'jp2h', 'jp2c'])
def test_default_layout_but_with_specified_boxes(self): def test_default_layout_but_with_specified_boxes(self):
j2k = Jp2k(self.j2kfile) j2k = Jp2k(self.j2kfile)
boxes = [JPEG2000SignatureBox(), boxes = [JPEG2000SignatureBox(),
@ -534,7 +542,6 @@ class TestJp2Boxes(unittest.TestCase):
with self.assertRaises(IOError): with self.assertRaises(IOError):
j2k.wrap(tfile.name, boxes=boxes) j2k.wrap(tfile.name, boxes=boxes)
def test_first_2_boxes_not_jP_and_ftyp(self): def test_first_2_boxes_not_jP_and_ftyp(self):
j2k = Jp2k(self.j2kfile) j2k = Jp2k(self.j2kfile)
c = j2k.get_codestream() c = j2k.get_codestream()

View file

@ -173,7 +173,7 @@ class TestJp2k(unittest.TestCase):
with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile: with tempfile.NamedTemporaryFile(suffix='.jp2') as tfile:
ofile = Jp2k(tfile.name, 'wb') ofile = Jp2k(tfile.name, 'wb')
with self.assertRaises(IOError): with self.assertRaises(IOError):
ofile.write(expdata[:,:,0], mct=True) ofile.write(expdata[:, :, 0], mct=True)
def test_write_cprl(self): def test_write_cprl(self):
# Issue 17 # Issue 17