def check(self, testinput, testoutput): args = rewrite_pydoc.parse_cmdline(['-f', testinput, '-o', 'ignored']) fname = rewrite_pydoc.get_input_file_name(args) contents = rewrite_pydoc.read_file_contents(fname) rewritten = rewrite_pydoc.rewrite(contents, '../../../../docs/src/common-text', '../../../../docs/src/graphics', False) expected = open(testoutput, 'r').read() self.assertEqual(rewritten, expected)
def check(self, testinput, testoutput): args = rewrite_pydoc.parse_cmdline(['-f', testinput, '-o', 'ignored']) fname = rewrite_pydoc.get_input_file_name(args) contents = rewrite_pydoc.read_file_contents(fname) rewritten = rewrite_pydoc.rewrite(contents, '../../../../docs/src/common-text', '../../../../docs/src/common-graphics', False) expected = open(testoutput, 'r').read() self.assertEqual(rewritten, expected)
def test_file_read(self): args = rewrite_pydoc.parse_cmdline( ['-f', 'test/data/001.i', '-o', 'ignored.bar']) fname = rewrite_pydoc.get_input_file_name(args) contents = rewrite_pydoc.read_file_contents(fname) self.assertEqual(contents, 'The contents.\n')
def test_input_file_arg(self): args = rewrite_pydoc.parse_cmdline( ['-f', 'foo.bar', '-o', 'ignored.bar']) fname = rewrite_pydoc.get_input_file_name(args) self.assertEqual(fname, 'foo.bar')
def test_graphics_arg(self): args = rewrite_pydoc.parse_cmdline( ['-f', 'ignored.bar', '-o', 'output.zap', '-g', 'foo']) dirname = rewrite_pydoc.get_graphics_dir(args) self.assertEqual(dirname, 'foo')
def test_input_file_arg(self): args = rewrite_pydoc.parse_cmdline(['-f', 'foo.bar', '-o', 'ignored.bar']) fname = rewrite_pydoc.get_input_file_name(args) self.assertEqual(fname, 'foo.bar')
def test_graphics_arg(self): args = rewrite_pydoc.parse_cmdline(['-f', 'ignored.bar', '-o', 'output.zap', '-g', 'foo']) dirname = rewrite_pydoc.get_graphics_dir(args) self.assertEqual(dirname, 'foo')
def test_file_read(self): args = rewrite_pydoc.parse_cmdline(['-f', 'test/data/001.i', '-o', 'ignored.bar']) fname = rewrite_pydoc.get_input_file_name(args) contents = rewrite_pydoc.read_file_contents(fname) self.assertEqual(contents, 'The contents.\n')