From 6adbae067bfd40fa93801d60bcab187a9014c948 Mon Sep 17 00:00:00 2001 From: John Evans Date: Fri, 23 May 2014 06:35:53 -0400 Subject: [PATCH] Irreversible test needed OPJ_DATA_ROOT decorator. #238 --- glymur/test/test_jp2k.py | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/glymur/test/test_jp2k.py b/glymur/test/test_jp2k.py index 49a491e..89d419e 100644 --- a/glymur/test/test_jp2k.py +++ b/glymur/test/test_jp2k.py @@ -401,23 +401,6 @@ class TestJp2k_write(unittest.TestCase): def tearDown(self): pass - def test_irreversible(self): - """Irreversible""" - filename = opj_data_file('input/nonregression/issue141.rawl') - expdata = np.fromfile(filename, dtype=np.uint16) - expdata.resize((2816, 2048)) - with tempfile.NamedTemporaryFile(suffix='.j2k') as tfile: - j = Jp2k(tfile.name, 'wb') - j.write(expdata, irreversible=True) - - codestream = j.get_codestream() - self.assertEqual(codestream.segment[2].spcod[8], - glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) - - actdata = j.read() - self.assertTrue(fixtures.mse(actdata, expdata) < 250) - - def test_cblkh_different_than_width(self): """Verify that we can set a code block size where height does not equal width. @@ -855,6 +838,23 @@ class TestJp2kOpjDataRootWarnings(unittest.TestCase): class TestJp2kOpjDataRoot(unittest.TestCase): """These tests should be run by just about all configuration.""" + @unittest.skipIf(os.name == "nt", "NamedTemporaryFile issue on windows") + def test_irreversible(self): + """Irreversible""" + filename = opj_data_file('input/nonregression/issue141.rawl') + expdata = np.fromfile(filename, dtype=np.uint16) + expdata.resize((2816, 2048)) + with tempfile.NamedTemporaryFile(suffix='.j2k') as tfile: + j = Jp2k(tfile.name, 'wb') + j.write(expdata, irreversible=True) + + codestream = j.get_codestream() + self.assertEqual(codestream.segment[2].spcod[8], + glymur.core.WAVELET_XFORM_9X7_IRREVERSIBLE) + + actdata = j.read() + self.assertTrue(fixtures.mse(actdata, expdata) < 250) + def test_no_cxform_pclr_jp2(self): """Indices for pclr jpxfile if no color transform""" filename = opj_data_file('input/conformance/file9.jp2')