moved test_exceeded_box_length into test_glymur_warnings
This commit is contained in:
parent
ddf17a9d18
commit
d00f84b6eb
2 changed files with 20 additions and 12 deletions
|
|
@ -28,6 +28,25 @@ from .fixtures import opj_data_file, OPJ_DATA_ROOT
|
|||
class TestWarnings(unittest.TestCase):
|
||||
"""Test suite for warnings issued by glymur."""
|
||||
|
||||
def test_exceeded_box_length(self):
|
||||
"""
|
||||
should warn if reading past end of a box
|
||||
|
||||
Verify that a warning is issued if we read past the end of a box
|
||||
This file has a palette (pclr) box whose length is impossibly
|
||||
short.
|
||||
"""
|
||||
infile = os.path.join(OPJ_DATA_ROOT,
|
||||
'input/nonregression/mem-b2ace68c-1381.jp2')
|
||||
regex = re.compile(r'''Encountered\san\sunrecoverable\sValueError\s
|
||||
while\sparsing\sa\spclr\sbox\sat\sbyte\soffset\s
|
||||
\d+\.\s+The\soriginal\serror\smessage\swas\s
|
||||
"total\ssize\sof\snew\sarray\smust\sbe\s
|
||||
unchanged"''',
|
||||
re.VERBOSE)
|
||||
with self.assertWarnsRegex(UserWarning, regex):
|
||||
Jp2k(infile)
|
||||
|
||||
def test_NR_DEC_issue188_beach_64bitsbox_jp2_41_decode(self):
|
||||
"""
|
||||
Has an 'XML ' box instead of 'xml '. Yes that is pedantic, but it
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ class TestSuiteNegative(unittest.TestCase):
|
|||
relpath = 'input/nonregression/illegalcolortransform.j2k'
|
||||
jfile = opj_data_file(relpath)
|
||||
jp2k = Jp2k(jfile)
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
with warnings.catch_warnings():
|
||||
warnings.simplefilter('ignore')
|
||||
codestream = jp2k.get_codestream(header_only=False)
|
||||
|
||||
|
|
@ -119,17 +119,6 @@ class TestSuiteNegative(unittest.TestCase):
|
|||
with self.assertRaises(IOError):
|
||||
j.write(data, cbsize=(2, 2048))
|
||||
|
||||
def test_exceeded_box(self):
|
||||
"""should warn if reading past end of a box"""
|
||||
# Verify that a warning is issued if we read past the end of a box
|
||||
# This file has a palette (pclr) box whose length is impossibly
|
||||
# short.
|
||||
infile = os.path.join(OPJ_DATA_ROOT,
|
||||
'input/nonregression/mem-b2ace68c-1381.jp2')
|
||||
with warnings.catch_warnings(record=True) as w:
|
||||
warnings.simplefilter('ignore')
|
||||
Jp2k(infile)
|
||||
|
||||
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
||||
def test_precinct_size_not_p2(self):
|
||||
"""precinct sizes should be powers of two."""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue