pep8 work.
This commit is contained in:
parent
29f1dcdc43
commit
3f8495a3bb
9 changed files with 28 additions and 22 deletions
|
|
@ -92,11 +92,11 @@ def read_config_file():
|
|||
try:
|
||||
lib['openjp2'] = parser.get('library', 'openjp2')
|
||||
except NoOptionError:
|
||||
pass
|
||||
pass
|
||||
try:
|
||||
lib['openjpeg'] = parser.get('library', 'openjpeg')
|
||||
except NoOptionError:
|
||||
pass
|
||||
pass
|
||||
|
||||
return lib
|
||||
|
||||
|
|
@ -109,7 +109,7 @@ def load_openjp2(libopenjp2_path):
|
|||
libopenjp2_path = find_library('openjp2')
|
||||
|
||||
if libopenjp2_path is None:
|
||||
return None
|
||||
return None
|
||||
|
||||
try:
|
||||
if os.name == "nt":
|
||||
|
|
@ -124,6 +124,7 @@ def load_openjp2(libopenjp2_path):
|
|||
|
||||
return openjp2_lib
|
||||
|
||||
|
||||
def glymur_config():
|
||||
"""Try to ascertain locations of openjp2, openjpeg libraries.
|
||||
"""
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import unittest
|
|||
|
||||
import glymur
|
||||
|
||||
|
||||
@unittest.skipIf(glymur.lib._openjpeg.OPENJPEG is None,
|
||||
"Missing openjpeg library.")
|
||||
class TestOpenJPEG(unittest.TestCase):
|
||||
|
|
@ -36,4 +37,3 @@ class TestOpenJPEG(unittest.TestCase):
|
|||
self.assertEqual(dp.jpwl_max_tiles, 0)
|
||||
self.assertEqual(dp.cp_limit_decoding, 0)
|
||||
self.assertEqual(dp.flags, 0)
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import sys
|
|||
|
||||
import numpy as np
|
||||
|
||||
|
||||
def mse(amat, bmat):
|
||||
"""Mean Square Error"""
|
||||
diff = amat.astype(np.double) - bmat.astype(np.double)
|
||||
|
|
@ -88,5 +89,3 @@ def read_pgx(pgx_file):
|
|||
data = np.fromfile(file=fptr, dtype=dtype).reshape(shape)
|
||||
|
||||
return(data.byteswap(swapbytes))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -98,9 +98,12 @@ class TestCallbacks15(unittest.TestCase):
|
|||
actual = sys.stdout.getvalue().strip()
|
||||
|
||||
regex = re.compile(r"""\[INFO\]\stile\s1\sof\s1\s+
|
||||
\[INFO\]\s-\stiers-1\stook\s[0-9]+\.[0-9]+\ss\s+
|
||||
\[INFO\]\s-\sdwt\stook\s(-){0,1}[0-9]+\.[0-9]+\ss\s+
|
||||
\[INFO\]\s-\stile\sdecoded\sin\s[0-9]+\.[0-9]+\ss""",
|
||||
\[INFO\]\s-\stiers-1\stook\s
|
||||
[0-9]+\.[0-9]+\ss\s+
|
||||
\[INFO\]\s-\sdwt\stook\s
|
||||
(-){0,1}[0-9]+\.[0-9]+\ss\s+
|
||||
\[INFO\]\s-\stile\sdecoded\sin\s
|
||||
[0-9]+\.[0-9]+\ss""",
|
||||
re.VERBOSE)
|
||||
if sys.hexversion <= 0x03020000:
|
||||
self.assertRegexpMatches(actual, regex)
|
||||
|
|
@ -108,6 +111,5 @@ class TestCallbacks15(unittest.TestCase):
|
|||
self.assertRegex(actual, regex)
|
||||
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
"""These tests are for edge cases where OPENJPEG does not exist, but
|
||||
"""These tests are for edge cases where OPENJPEG does not exist, but
|
||||
OPENJP2 may be present in some form or other.
|
||||
"""
|
||||
#pylint: disable-all
|
||||
|
|
|
|||
|
|
@ -297,7 +297,7 @@ class TestXML(unittest.TestCase):
|
|||
with self.assertRaises((IOError, OSError)) as ce:
|
||||
xmlb = glymur.jp2box.XMLBox(filename=self.xmlfile, xml=xml_object)
|
||||
|
||||
@unittest.skipIf(os.name == "nt",
|
||||
@unittest.skipIf(os.name == "nt",
|
||||
"Problems using NamedTemporaryFile on windows.")
|
||||
def test_basic_xml(self):
|
||||
# Should be able to write an XMLBox.
|
||||
|
|
@ -319,7 +319,7 @@ class TestXML(unittest.TestCase):
|
|||
self.assertEqual(ET.tostring(jp2.box[3].xml),
|
||||
b'<data>0</data>')
|
||||
|
||||
@unittest.skipIf(os.name == "nt",
|
||||
@unittest.skipIf(os.name == "nt",
|
||||
"Problems using NamedTemporaryFile on windows.")
|
||||
def test_xml_from_file(self):
|
||||
j2k = Jp2k(self.j2kfile)
|
||||
|
|
@ -365,7 +365,7 @@ class TestColourSpecificationBox(unittest.TestCase):
|
|||
def tearDown(self):
|
||||
pass
|
||||
|
||||
@unittest.skipIf(os.name == "nt",
|
||||
@unittest.skipIf(os.name == "nt",
|
||||
"Problems using NamedTemporaryFile on windows.")
|
||||
def test_color_specification_box_with_out_enumerated_colorspace(self):
|
||||
j2k = Jp2k(self.j2kfile)
|
||||
|
|
|
|||
|
|
@ -102,7 +102,6 @@ class TestJp2kBadXmlFile(unittest.TestCase):
|
|||
self.assertIsNone(jp2k.box[3].xml)
|
||||
|
||||
|
||||
|
||||
@unittest.skipIf(glymur.lib.openjp2.OPENJP2 is None,
|
||||
"Missing openjp2 library.")
|
||||
class TestJp2k(unittest.TestCase):
|
||||
|
|
@ -634,10 +633,10 @@ class TestJp2k(unittest.TestCase):
|
|||
Invalid\svalues\sfor\scomp\s=\s0\s+
|
||||
:\sdx=1\sdy=0''', re.VERBOSE)
|
||||
if sys.hexversion < 0x03020000:
|
||||
with self.assertRaisesRegexp((IOError, OSError), regexp) as ce:
|
||||
with self.assertRaisesRegexp((IOError, OSError), regexp):
|
||||
d = j.read(rlevel=1)
|
||||
else:
|
||||
with self.assertRaisesRegex((IOError, OSError), regexp) as ce:
|
||||
with self.assertRaisesRegex((IOError, OSError), regexp):
|
||||
d = j.read(rlevel=1)
|
||||
|
||||
def test_xmp_attribute(self):
|
||||
|
|
|
|||
|
|
@ -4216,7 +4216,8 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# Jp2 Header
|
||||
# Colour specification
|
||||
self.assertEqual(jp2.box[3].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # enumerated
|
||||
self.assertEqual(jp2.box[3].box[1].method,
|
||||
glymur.core.RESTRICTED_ICC_PROFILE) # enumerated
|
||||
self.assertEqual(jp2.box[3].box[1].precedence, 0)
|
||||
self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact
|
||||
self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 546)
|
||||
|
|
@ -4313,7 +4314,8 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# Jp2 Header
|
||||
# Colour specification
|
||||
self.assertEqual(jp2.box[3].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE)
|
||||
self.assertEqual(jp2.box[3].box[1].method,
|
||||
glymur.core.RESTRICTED_ICC_PROFILE)
|
||||
self.assertEqual(jp2.box[3].box[1].precedence, 0)
|
||||
self.assertEqual(jp2.box[3].box[1].approximation, 1) # JPX exact
|
||||
self.assertEqual(jp2.box[3].box[1].icc_profile['Size'], 13332)
|
||||
|
|
@ -4363,7 +4365,8 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# Jp2 Header
|
||||
# Colour specification
|
||||
self.assertEqual(jp2.box[2].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # enumerated
|
||||
self.assertEqual(jp2.box[2].box[1].method,
|
||||
glymur.core.RESTRICTED_ICC_PROFILE) # enumerated
|
||||
self.assertEqual(jp2.box[2].box[1].precedence, 0)
|
||||
self.assertEqual(jp2.box[2].box[1].approximation, 1) # JPX exact
|
||||
self.assertEqual(jp2.box[2].box[1].icc_profile['Size'], 414)
|
||||
|
|
@ -7080,7 +7083,8 @@ class TestSuiteDump(unittest.TestCase):
|
|||
|
||||
# Jp2 Header
|
||||
# Colour specification
|
||||
self.assertEqual(jp2.box[2].box[1].method, glymur.core.RESTRICTED_ICC_PROFILE) # res icc
|
||||
self.assertEqual(jp2.box[2].box[1].method,
|
||||
glymur.core.RESTRICTED_ICC_PROFILE)
|
||||
self.assertEqual(jp2.box[2].box[1].precedence, 0)
|
||||
self.assertEqual(jp2.box[2].box[1].approximation, 0) # JP2
|
||||
self.assertIsNone(jp2.box[2].box[1].icc_profile)
|
||||
|
|
|
|||
|
|
@ -22,8 +22,9 @@
|
|||
| | | | gracefully. |
|
||||
+------------+------------+------------+--------------------------------------+
|
||||
| Fedora 18 | | X | Ships with 1.5.1. 167 of 445 tests |
|
||||
| | | | should pass (no OPJ_DATA_ROOT). |
|
||||
| | | | should pass. |
|
||||
+------------+------------+------------+--------------------------------------+
|
||||
|
||||
Pylint on entire package should be at least 0.95.
|
||||
pep8 should be pass cleanly.
|
||||
Coverage should exceed 95%.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue