1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
|
from stub_generator.parse_docs import Docs
def test_multiple_declaration_with_docstrings():
text = """
getEmpire() -> empire :
Returns B
getEmpire( (int)arg1) -> empire :
Returns A
""".strip(
"\n"
)
docs = Docs(text, indent=0, is_class=False)
assert list(docs.get_argument_strings()) == ["", "number: int"]
assert docs.get_doc_string() == ('"""\nReturns B\nReturns A\n"""')
def test_single_declaration_with_docstrings():
text = """
empirePlayerID( (int)arg1) -> int :
Returns ...
""".strip(
"\n"
)
docs = Docs(text, indent=0, is_class=False)
assert list(docs.get_argument_strings()) == ["number: int"]
assert docs.get_doc_string() == '"""\nReturns ...\n"""'
def test_docs_single_line():
text = "inQueue( (researchQueue)arg1, (str)arg2) -> bool"
docs = Docs(text, indent=0, is_class=False)
assert list(docs.get_argument_strings()) == ["research_queue: researchQueue, string: str"]
assert docs.get_doc_string() == ""
|