Exemplo n.º 1
0
 def test_deprecated_set_get_printoptions(self):
     """
     Verify deprecated get_printoptions and set_printoptions
     """
     with self.assertWarns(DeprecationWarning):
         glymur.set_printoptions(short=True)
     with self.assertWarns(DeprecationWarning):
         glymur.set_printoptions(xml=True)
     with self.assertWarns(DeprecationWarning):
         glymur.set_printoptions(codestream=True)
     with self.assertWarns(DeprecationWarning):
         glymur.get_printoptions()
Exemplo n.º 2
0
 def test_deprecated_set_get_printoptions(self):
     """
     Verify deprecated get_printoptions and set_printoptions
     """
     with self.assertWarns(DeprecationWarning):
         glymur.set_printoptions(short=True)
     with self.assertWarns(DeprecationWarning):
         glymur.set_printoptions(xml=True)
     with self.assertWarns(DeprecationWarning):
         glymur.set_printoptions(codestream=True)
     with self.assertWarns(DeprecationWarning):
         glymur.get_printoptions()
Exemplo n.º 3
0
    def test_suppress_codestream_old_option(self):
        """
        Verify printing with codestream suppressed, deprecated
        """
        jp2 = Jp2k(self.jp2file)
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            glymur.set_printoptions(codestream=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:])

        expected = fixtures.nemo_dump_no_codestream
        self.assertEqual(actual, expected)

        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            opt = glymur.get_printoptions()['codestream']
        self.assertFalse(opt)
Exemplo n.º 4
0
    def test_old_short_option(self):
        """
        Verify printing with deprecated set_printoptions "short"
        """
        jp2 = Jp2k(self.jp2file)
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            glymur.set_printoptions(short=True)
        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:])

        expected = fixtures.nemo_dump_short
        self.assertEqual(actual, expected)

        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            opt = glymur.get_printoptions()['short']
        self.assertTrue(opt)
Exemplo n.º 5
0
    def test_old_short_option(self):
        """
        Verify printing with deprecated set_printoptions "short"
        """
        jp2 = Jp2k(self.jp2file)
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            glymur.set_printoptions(short=True)

        actual = str(jp2)

        # Get rid of leading "File" line, as that is volatile.
        actual = '\n'.join(actual.splitlines()[1:])

        expected = fixtures.nemo_dump_short
        self.assertEqual(actual, expected)

        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            opt = glymur.get_printoptions()['short']
        self.assertTrue(opt)
Exemplo n.º 6
0
    def test_suppress_xml_old_option(self):
        """
        Verify printing with xml suppressed, deprecated method
        """
        jp2 = Jp2k(self.jp2file)
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            glymur.set_printoptions(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)

        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            opt = glymur.get_printoptions()['xml']
        self.assertFalse(opt)
Exemplo n.º 7
0
    def test_suppress_xml_old_option(self):
        """
        Verify printing with xml suppressed, deprecated method
        """
        jp2 = Jp2k(self.jp2file)
        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            glymur.set_printoptions(xml=False)

        actual = str(jp2)

        # Get rid of leading "File" line, as that is 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)

        with warnings.catch_warnings():
            warnings.simplefilter('ignore')
            opt = glymur.get_printoptions()['xml']
        self.assertFalse(opt)