all tests passing on opensuse
This commit is contained in:
parent
4ceb4dce61
commit
059bee50e2
4 changed files with 36 additions and 20 deletions
|
|
@ -69,7 +69,7 @@ class TestWarnings(unittest.TestCase):
|
||||||
\(\d+\)\.""",
|
\(\d+\)\.""",
|
||||||
re.VERBOSE)
|
re.VERBOSE)
|
||||||
with self.assertWarnsRegex(UserWarning, regex):
|
with self.assertWarnsRegex(UserWarning, regex):
|
||||||
Jp2k(jfile)
|
Jp2k(jfile).get_codestream()
|
||||||
|
|
||||||
@unittest.skipIf(re.match("1.5|2.0.0", glymur.version.openjpeg_version),
|
@unittest.skipIf(re.match("1.5|2.0.0", glymur.version.openjpeg_version),
|
||||||
"Test not passing on 1.5.x, not introduced until 2.x")
|
"Test not passing on 1.5.x, not introduced until 2.x")
|
||||||
|
|
@ -84,7 +84,7 @@ class TestWarnings(unittest.TestCase):
|
||||||
\(\d+\)\.""",
|
\(\d+\)\.""",
|
||||||
re.VERBOSE)
|
re.VERBOSE)
|
||||||
with self.assertWarnsRegex(UserWarning, regex):
|
with self.assertWarnsRegex(UserWarning, regex):
|
||||||
Jp2k(jfile)
|
Jp2k(jfile).get_codestream()
|
||||||
|
|
||||||
def test_NR_gdal_fuzzer_check_comp_dx_dy_jp2_dump(self):
|
def test_NR_gdal_fuzzer_check_comp_dx_dy_jp2_dump(self):
|
||||||
"""
|
"""
|
||||||
|
|
@ -97,7 +97,7 @@ class TestWarnings(unittest.TestCase):
|
||||||
dx=\d+,\s*dy=\d+""",
|
dx=\d+,\s*dy=\d+""",
|
||||||
re.VERBOSE)
|
re.VERBOSE)
|
||||||
with self.assertWarnsRegex(UserWarning, regex):
|
with self.assertWarnsRegex(UserWarning, regex):
|
||||||
Jp2k(jfile)
|
Jp2k(jfile).get_codestream()
|
||||||
|
|
||||||
def test_NR_gdal_fuzzer_assert_in_opj_j2k_read_SQcd_SQcc_patch_jp2(self):
|
def test_NR_gdal_fuzzer_assert_in_opj_j2k_read_SQcd_SQcc_patch_jp2(self):
|
||||||
lst = ['input', 'nonregression',
|
lst = ['input', 'nonregression',
|
||||||
|
|
@ -107,32 +107,32 @@ class TestWarnings(unittest.TestCase):
|
||||||
number\sof\scomponents\sis\sonly\s\d+""",
|
number\sof\scomponents\sis\sonly\s\d+""",
|
||||||
re.VERBOSE)
|
re.VERBOSE)
|
||||||
with self.assertWarnsRegex(UserWarning, regex):
|
with self.assertWarnsRegex(UserWarning, regex):
|
||||||
Jp2k(jfile)
|
Jp2k(jfile).get_codestream()
|
||||||
|
|
||||||
def test_bad_rsiz(self):
|
def test_bad_rsiz(self):
|
||||||
"""Should warn if RSIZ is bad. Issue196"""
|
"""Should warn if RSIZ is bad. Issue196"""
|
||||||
filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2')
|
filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2')
|
||||||
with self.assertWarnsRegex(UserWarning, 'Invalid profile'):
|
with self.assertWarnsRegex(UserWarning, 'Invalid profile'):
|
||||||
Jp2k(filename)
|
Jp2k(filename).get_codestream()
|
||||||
|
|
||||||
def test_bad_wavelet_transform(self):
|
def test_bad_wavelet_transform(self):
|
||||||
"""Should warn if wavelet transform is bad. Issue195"""
|
"""Should warn if wavelet transform is bad. Issue195"""
|
||||||
filename = opj_data_file('input/nonregression/edf_c2_10025.jp2')
|
filename = opj_data_file('input/nonregression/edf_c2_10025.jp2')
|
||||||
with self.assertWarnsRegex(UserWarning, 'Invalid wavelet transform'):
|
with self.assertWarnsRegex(UserWarning, 'Invalid wavelet transform'):
|
||||||
Jp2k(filename)
|
Jp2k(filename).get_codestream()
|
||||||
|
|
||||||
def test_invalid_progression_order(self):
|
def test_invalid_progression_order(self):
|
||||||
"""Should still be able to parse even if prog order is invalid."""
|
"""Should still be able to parse even if prog order is invalid."""
|
||||||
jfile = opj_data_file('input/nonregression/2977.pdf.asan.67.2198.jp2')
|
jfile = opj_data_file('input/nonregression/2977.pdf.asan.67.2198.jp2')
|
||||||
with self.assertWarnsRegex(UserWarning, 'Invalid progression order'):
|
with self.assertWarnsRegex(UserWarning, 'Invalid progression order'):
|
||||||
Jp2k(jfile)
|
Jp2k(jfile).get_codestream()
|
||||||
|
|
||||||
def test_tile_height_is_zero(self):
|
def test_tile_height_is_zero(self):
|
||||||
"""Zero tile height should not cause an exception."""
|
"""Zero tile height should not cause an exception."""
|
||||||
filename = 'input/nonregression/2539.pdf.SIGFPE.706.1712.jp2'
|
filename = 'input/nonregression/2539.pdf.SIGFPE.706.1712.jp2'
|
||||||
filename = opj_data_file(filename)
|
filename = opj_data_file(filename)
|
||||||
with self.assertWarnsRegex(UserWarning, 'Invalid tile dimensions'):
|
with self.assertWarnsRegex(UserWarning, 'Invalid tile dimensions'):
|
||||||
Jp2k(filename)
|
Jp2k(filename).get_codestream()
|
||||||
|
|
||||||
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
@unittest.skipIf(os.name == "nt", "Temporary file issue on window.")
|
||||||
def test_unknown_marker_segment(self):
|
def test_unknown_marker_segment(self):
|
||||||
|
|
|
||||||
|
|
@ -36,6 +36,9 @@ from .fixtures import OPJ_DATA_ROOT, opj_data_file
|
||||||
from . import fixtures
|
from . import fixtures
|
||||||
|
|
||||||
|
|
||||||
|
def docTearDown(doctest_obj):
|
||||||
|
glymur.set_parseoptions(full_codestream=False)
|
||||||
|
|
||||||
# Doc tests should be run as well.
|
# Doc tests should be run as well.
|
||||||
def load_tests(loader, tests, ignore):
|
def load_tests(loader, tests, ignore):
|
||||||
"""Should run doc tests as well"""
|
"""Should run doc tests as well"""
|
||||||
|
|
@ -43,7 +46,8 @@ def load_tests(loader, tests, ignore):
|
||||||
# Can't do it on windows, temporary file issue.
|
# Can't do it on windows, temporary file issue.
|
||||||
return tests
|
return tests
|
||||||
if glymur.lib.openjp2.OPENJP2 is not None:
|
if glymur.lib.openjp2.OPENJP2 is not None:
|
||||||
tests.addTests(doctest.DocTestSuite('glymur.jp2k'))
|
tests.addTests(doctest.DocTestSuite('glymur.jp2k',
|
||||||
|
tearDown=docTearDown))
|
||||||
return tests
|
return tests
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1075,6 +1079,9 @@ class TestParsing(unittest.TestCase):
|
||||||
class TestJp2kOpjDataRootWarnings(unittest.TestCase):
|
class TestJp2kOpjDataRootWarnings(unittest.TestCase):
|
||||||
"""These tests should be run by just about all configuration."""
|
"""These tests should be run by just about all configuration."""
|
||||||
|
|
||||||
|
def tearDown(self):
|
||||||
|
glymur.set_parseoptions(full_codestream=False)
|
||||||
|
|
||||||
def test_undecodeable_box_id(self):
|
def test_undecodeable_box_id(self):
|
||||||
"""Should warn in case of undecodeable box ID but not error out."""
|
"""Should warn in case of undecodeable box ID but not error out."""
|
||||||
filename = opj_data_file('input/nonregression/edf_c2_1013627.jp2')
|
filename = opj_data_file('input/nonregression/edf_c2_1013627.jp2')
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ suite.
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
import unittest
|
import unittest
|
||||||
|
import warnings
|
||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
|
|
@ -2913,21 +2914,29 @@ class TestSuiteWarns(MetadataBase):
|
||||||
|
|
||||||
def test_NR_broken4_jp2_dump(self):
|
def test_NR_broken4_jp2_dump(self):
|
||||||
jfile = opj_data_file('input/nonregression/broken4.jp2')
|
jfile = opj_data_file('input/nonregression/broken4.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with warnings.catch_warnings():
|
||||||
jp2 = Jp2k(jfile)
|
# Suppress a warning, all we really care is parsing the entire
|
||||||
|
# file.
|
||||||
self.assertEqual(jp2.box[-1].codestream.segment[-1].marker_id, 'QCC')
|
warnings.simplefilter("ignore")
|
||||||
|
with self.assertWarns(UserWarning):
|
||||||
|
jp2 = Jp2k(jfile)
|
||||||
|
self.assertEqual(jp2.box[-1].codestream.segment[-1].marker_id,
|
||||||
|
'QCC')
|
||||||
|
|
||||||
def test_NR_broken2_jp2_dump(self):
|
def test_NR_broken2_jp2_dump(self):
|
||||||
"""
|
"""
|
||||||
Invalid marker ID in the codestream.
|
Invalid marker ID in the codestream.
|
||||||
"""
|
"""
|
||||||
jfile = opj_data_file('input/nonregression/broken2.jp2')
|
jfile = opj_data_file('input/nonregression/broken2.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with warnings.catch_warnings():
|
||||||
# Invalid marker ID on codestream.
|
# Suppress a warning, all we really care is parsing the entire
|
||||||
jp2 = Jp2k(jfile)
|
# file.
|
||||||
|
warnings.simplefilter("ignore")
|
||||||
self.assertEqual(jp2.box[-1].codestream.segment[-1].marker_id, 'QCC')
|
with self.assertWarns(UserWarning):
|
||||||
|
# Invalid marker ID on codestream.
|
||||||
|
jp2 = Jp2k(jfile)
|
||||||
|
self.assertEqual(jp2.box[-1].codestream.segment[-1].marker_id,
|
||||||
|
'QCC')
|
||||||
|
|
||||||
def test_NR_file1_dump(self):
|
def test_NR_file1_dump(self):
|
||||||
jfile = opj_data_file('input/conformance/file1.jp2')
|
jfile = opj_data_file('input/conformance/file1.jp2')
|
||||||
|
|
|
||||||
|
|
@ -42,7 +42,7 @@ class TestPrinting(unittest.TestCase):
|
||||||
glymur.set_printoptions(short=False, xml=True, codestream=True)
|
glymur.set_printoptions(short=False, xml=True, codestream=True)
|
||||||
|
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
pass
|
glymur.set_parseoptions(full_codestream=False)
|
||||||
|
|
||||||
def test_version_info(self):
|
def test_version_info(self):
|
||||||
"""Should be able to print(glymur.version.info)"""
|
"""Should be able to print(glymur.version.info)"""
|
||||||
|
|
@ -854,7 +854,7 @@ class TestPrintingOpjDataRootWarns(unittest.TestCase):
|
||||||
"""Should still be able to print if rsiz is bad, issue196"""
|
"""Should still be able to print if rsiz is bad, issue196"""
|
||||||
filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2')
|
filename = opj_data_file('input/nonregression/edf_c2_1002767.jp2')
|
||||||
with self.assertWarns(UserWarning):
|
with self.assertWarns(UserWarning):
|
||||||
j = Jp2k(filename)
|
j = Jp2k(filename).get_codestream()
|
||||||
with patch('sys.stdout', new=StringIO()):
|
with patch('sys.stdout', new=StringIO()):
|
||||||
print(j)
|
print(j)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue