コード例 #1
0
ファイル: test_cli.py プロジェクト: heavenshell/py-doq
    def test_output_with_google_style(self):
        expected_path = os.path.join(self.basepath, 'tests', 'expected',
                                     'google')

        for file in self.files:
            with open(os.path.join(self.fixtures_path, file)) as f:
                args = argparse.Namespace(
                    file=f,
                    start=1,
                    end=0,
                    template_path=None,
                    formatter='google',
                    style='string',
                    indent=4,
                    recursive=False,
                    write=False,
                    omit=None,
                    ignore_exception=False,
                    ignore_yield=False,
                    ignore_init=False,
                    config=None,
                )
                with patch('doq.cli.sys.stdout', new_callable=StringIO) as p:
                    run(args)
            actual = p.getvalue().split('\n')
            with open(os.path.join(expected_path, file)) as f:
                expected = f.read().split('\n')

            self.assertSequenceEqual(expected, actual)
コード例 #2
0
 def test_no_output_with_sphinx_style(self):
     for file in self.ignore_files:
         with open(os.path.join(self.fixtures_path, file)) as f:
             args = argparse.Namespace(
                 file=f,
                 start=1,
                 end=0,
                 template_path=None,
                 formatter='sphinx',
                 style='string',
                 indent=4,
                 recursive=False,
                 write=False,
                 omit=None,
                 ignore_exception=False,
             )
             with patch('doq.cli.sys.stdout', new_callable=StringIO) as p:
                 run(args)
         actual = p.getvalue().split('\n')
         self.assertSequenceEqual([''], actual)