def test_reset_single_option(self): """ Verify a single option can be reset. """ glymur.set_option('print.codestream', True) glymur.reset_option('print.codestream') self.assertTrue(glymur.get_option('print.codestream'))
def test_full_codestream(self): """ Verify printing with the full blown codestream """ jp2 = Jp2k(self.jp2file) glymur.set_option('parse.full_codestream', True) # Get rid of the file line actual = '\n'.join(str(jp2).splitlines()[1:]) expected = fixtures.nemo self.assertEqual(actual, expected) opt = glymur.get_option('print.codestream') self.assertTrue(opt)
def test_suppress_codestream(self): """ Verify printing with codestream suppressed """ jp2 = Jp2k(self.jp2file) glymur.set_option('print.codestream', False) # Get rid of the file line actual = '\n'.join(str(jp2).splitlines()[1:]) expected = fixtures.nemo_dump_no_codestream self.assertEqual(actual, expected) opt = glymur.get_option('print.codestream') self.assertFalse(opt)
def test_suppress_xml(self): """ Verify printing with xml suppressed """ jp2 = Jp2k(self.jp2file) glymur.set_option('print.xml', False) with patch('sys.stdout', new=StringIO()) as fake_out: print(jp2) actual = fake_out.getvalue().strip() # Get rid of the file line, that's kind of volatile. actual = '\n'.join(actual.splitlines()[1:]) # shave off the XML and non-main-header segments expected = fixtures.nemo_dump_no_xml self.assertEqual(actual, expected) opt = glymur.get_option('print.xml') self.assertFalse(opt)
def test_suppress_xml(self): """ Verify printing with xml suppressed """ jp2 = Jp2k(self.jp2file) glymur.set_option('print.xml', False) actual = str(jp2) # Get rid of the file line, that's kind of volatile. actual = '\n'.join(actual.splitlines()[1:]) # shave off the XML and non-main-header segments expected = fixtures.nemo_dump_no_xml self.assertEqual(actual, expected) opt = glymur.get_option('print.xml') self.assertFalse(opt)