def test_func_with_raise(self) -> None: parser = SphinxParser() doc = pydoc.getdoc(tests.test_parsers.sphinx_class.RaisesClass.func_with_raise) actual_exceptions = parser.get_exceptions_raised(doc) expected_exceptions = [ 'RuntimeError', 'ValueError', 'IndexError' ] assert len(expected_exceptions) == len(actual_exceptions) intersection = set(expected_exceptions) - set(actual_exceptions) assert len(intersection) == 0
def test_func_with_raise_and_args(self) -> None: parser = SphinxParser() doc = pydoc.getdoc(tests.test_parsers.sphinx_class.RaisesClass.func_with_raise_and_args) actual_exceptions = parser.get_exceptions_raised(doc) expected_exceptions = [ 'RuntimeError', 'ValueError', 'IndexError' ] assert len(expected_exceptions) == len(actual_exceptions) intersection = set(expected_exceptions) - set(actual_exceptions) assert len(intersection) == 0 parameters = parser.get_parameters(doc, tests.test_parsers.sphinx_class) assert len(parameters) == 2 assert parameters[0].name == 'a' assert parameters[0].type == int assert parameters[1].name == 'b' assert parameters[1].type == float