Updated affected tests. Closes #78.
This commit is contained in:
parent
b082e5e9d8
commit
510e5c2d14
1 changed files with 39 additions and 20 deletions
|
|
@ -823,12 +823,16 @@ class TestSuite(unittest.TestCase):
|
|||
self.assertTrue(True)
|
||||
|
||||
def test_NR_DEC_broken2_jp2_5_decode(self):
|
||||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/broken2.jp2')
|
||||
# Null pointer access
|
||||
jfile = os.path.join(data_root, 'input/nonregression/broken2.jp2')
|
||||
with self.assertRaises(IOError):
|
||||
data = Jp2k(jfile).read()
|
||||
with warnings.catch_warnings():
|
||||
# Library warning, invalid number of subbands.
|
||||
warnings.simplefilter("ignore")
|
||||
data = Jp2k(jfile).read()
|
||||
self.assertTrue(True)
|
||||
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2.")
|
||||
def test_NR_DEC_broken3_jp2_6_decode(self):
|
||||
|
|
@ -845,7 +849,10 @@ class TestSuite(unittest.TestCase):
|
|||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/broken4.jp2')
|
||||
with self.assertRaises(IOError):
|
||||
data = Jp2k(jfile).read()
|
||||
with warnings.catch_warnings():
|
||||
# Library warning, invalid number of subbands.
|
||||
warnings.simplefilter("ignore")
|
||||
data = Jp2k(jfile).read()
|
||||
self.assertTrue(True)
|
||||
|
||||
@unittest.skip("fprintf stderr output in r2343.")
|
||||
|
|
@ -6003,13 +6010,16 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[6]._exponent,
|
||||
[8] + [9, 9, 10] * 5)
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2, 'assertWarns'.")
|
||||
def test_NR_broken2_jp2_dump(self):
|
||||
# Invalid marker ID on codestream.
|
||||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/broken2.jp2')
|
||||
with self.assertRaises(IOError):
|
||||
jfile = os.path.join(data_root, 'input/nonregression/broken2.jp2')
|
||||
with self.assertWarns(UserWarning):
|
||||
jp2 = Jp2k(jfile)
|
||||
|
||||
self.assertEqual(jp2.box[-1].main_header.segment[-1].marker_id, 'QCC')
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2.")
|
||||
def test_NR_broken3_jp2_dump(self):
|
||||
|
|
@ -6137,12 +6147,16 @@ class TestSuiteDump(unittest.TestCase):
|
|||
self.assertEqual(c.segment[6]._exponent,
|
||||
[8] + [9, 9, 10] * 5)
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2, 'assertWarns'")
|
||||
def test_NR_broken4_jp2_dump(self):
|
||||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/broken4.jp2')
|
||||
with self.assertRaises(IOError):
|
||||
# Has an invalid marker in the main header
|
||||
jfile = os.path.join(data_root, 'input/nonregression/broken4.jp2')
|
||||
with self.assertWarns(UserWarning):
|
||||
jp2 = Jp2k(jfile)
|
||||
|
||||
self.assertEqual(jp2.box[-1].main_header.segment[-1].marker_id, 'QCC')
|
||||
|
||||
def test_NR_file409752(self):
|
||||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/file409752.jp2')
|
||||
|
|
@ -7800,17 +7814,19 @@ class TestSuite15(unittest.TestCase):
|
|||
self.assertTrue(True)
|
||||
|
||||
def test_NR_DEC_broken2_jp2_5_decode(self):
|
||||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/broken2.jp2')
|
||||
with self.assertRaises(IOError):
|
||||
data = Jp2k(jfile).read()
|
||||
# Null pointer access
|
||||
jfile = os.path.join(data_root, 'input/nonregression/broken2.jp2')
|
||||
with self.assertRaises(ValueError):
|
||||
with warnings.catch_warnings():
|
||||
# Library warning, invalid number of subbands.
|
||||
warnings.simplefilter("ignore")
|
||||
data = Jp2k(jfile).read()
|
||||
self.assertTrue(True)
|
||||
|
||||
@unittest.skipIf(sys.hexversion < 0x03020000,
|
||||
"Uses features introduced in 3.2.")
|
||||
def test_NR_DEC_broken3_jp2_6_decode(self):
|
||||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/broken3.jp2')
|
||||
jfile = os.path.join(data_root, 'input/nonregression/broken3.jp2')
|
||||
with self.assertWarns(UserWarning) as cw:
|
||||
# colr box has bad length.
|
||||
j = Jp2k(jfile)
|
||||
|
|
@ -7819,10 +7835,13 @@ class TestSuite15(unittest.TestCase):
|
|||
d = j.read()
|
||||
|
||||
def test_NR_DEC_broken4_jp2_7_decode(self):
|
||||
jfile = os.path.join(data_root,
|
||||
'input/nonregression/broken4.jp2')
|
||||
with self.assertRaises(IOError):
|
||||
data = Jp2k(jfile).read()
|
||||
# Null pointer access
|
||||
jfile = os.path.join(data_root, 'input/nonregression/broken4.jp2')
|
||||
with self.assertRaises(ValueError):
|
||||
with warnings.catch_warnings():
|
||||
# Library warning, invalid number of subbands.
|
||||
warnings.simplefilter("ignore")
|
||||
data = Jp2k(jfile).read()
|
||||
self.assertTrue(True)
|
||||
|
||||
@unittest.skip("fprintf stderr output in r2343.")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue