示例#1
0
 def test_j2k_codestream_0(self):
     """-c 0 should print just a single line when used on a codestream."""
     sys.argv = ['', '-c', '0', self.j2kfile]
     with patch('sys.stdout', new=StringIO()) as fake_out:
         command_line.main()
         actual = fake_out.getvalue().strip()
     self.assertRegex(actual, "File:  .*")
示例#2
0
    def test_j2k_codestream_2(self):
        """Verify dumping with -c 2, full details."""
        with patch('sys.stdout', new=StringIO()) as fake_out:
            sys.argv = ['', '-c', '2', self.j2kfile]
            command_line.main()
            actual = fake_out.getvalue().strip()

        self.assertIn(fixtures.goodstuff_with_full_header, actual)
示例#3
0
 def run_jp2dump(self, args):
     sys.argv = args
     with patch('sys.stdout', new=StringIO()) as fake_out:
         command_line.main()
         actual = fake_out.getvalue().strip()
         # Remove the file line, as that is filesystem-dependent.
         lines = actual.split('\n')
         actual = '\n'.join(lines[1:])
     return actual
示例#4
0
 def test_codestream_invalid(self):
     """Verify dumping with -c 3, not allowd."""
     with self.assertRaises(ValueError):
         sys.argv = ['', '-c', '3', self.jp2file]
         command_line.main()