コード例 #1
0
ファイル: test_raise_visitor.py プロジェクト: tsx/darglint
    def assertFound(self, program, *exceptions):
        """Assert that the given exceptions were detected.

        Args:
            program: The program to run the analysis on.
            exceptions: The exceptions which should have been
                detected as being raised.

        """
        function = ast.parse(program).body[0]
        visitor = RaiseVisitor()
        visitor.visit(function)
        for exception in exceptions:
            self.assertTrue(
                exception in visitor.exceptions,
                'Expected to find {} in exceptions, but did not.'.format(
                    exception))