generated from jCloud/repository-template
test(cli): add tests for Python sections list parser
This commit is contained in:
1 file changed
+102
@@ -15,6 +15,108 @@
|
|||||||
import pathlib
|
import pathlib
|
||||||
import pytest
|
import pytest
|
||||||
from jcloud_docsgen.cli.cli import create_argument_parser, main as cli_main
|
from jcloud_docsgen.cli.cli import create_argument_parser, main as cli_main
|
||||||
|
from jcloud_docsgen.cli.languages.python import parse_sections_list
|
||||||
|
from jcloud_docsgen.core.python import PythonDefinitionDocumentationIncludeSections
|
||||||
|
|
||||||
|
@pytest.mark.parametrize('include,exclude,expected', [
|
||||||
|
(
|
||||||
|
[],
|
||||||
|
[],
|
||||||
|
PythonDefinitionDocumentationIncludeSections(
|
||||||
|
signature = False,
|
||||||
|
returns = False,
|
||||||
|
params = False,
|
||||||
|
exceptions = False,
|
||||||
|
examples = False,
|
||||||
|
docstring = False,
|
||||||
|
bases = False,
|
||||||
|
decorators = False,
|
||||||
|
class_body = False
|
||||||
|
)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
[],
|
||||||
|
['signature'],
|
||||||
|
PythonDefinitionDocumentationIncludeSections(
|
||||||
|
signature = False,
|
||||||
|
returns = False,
|
||||||
|
params = False,
|
||||||
|
exceptions = False,
|
||||||
|
examples = False,
|
||||||
|
docstring = False,
|
||||||
|
bases = False,
|
||||||
|
decorators = False,
|
||||||
|
class_body = False
|
||||||
|
)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
['signature'],
|
||||||
|
['signature'],
|
||||||
|
PythonDefinitionDocumentationIncludeSections(
|
||||||
|
signature = False,
|
||||||
|
returns = False,
|
||||||
|
params = False,
|
||||||
|
exceptions = False,
|
||||||
|
examples = False,
|
||||||
|
docstring = False,
|
||||||
|
bases = False,
|
||||||
|
decorators = False,
|
||||||
|
class_body = False
|
||||||
|
)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
['signature'],
|
||||||
|
[],
|
||||||
|
PythonDefinitionDocumentationIncludeSections(
|
||||||
|
signature = True,
|
||||||
|
returns = False,
|
||||||
|
params = False,
|
||||||
|
exceptions = False,
|
||||||
|
examples = False,
|
||||||
|
docstring = False,
|
||||||
|
bases = False,
|
||||||
|
decorators = False,
|
||||||
|
class_body = False
|
||||||
|
)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
None,
|
||||||
|
[],
|
||||||
|
PythonDefinitionDocumentationIncludeSections()
|
||||||
|
),
|
||||||
|
(
|
||||||
|
['signature', 'exceptions', 'bases', 'class_body'],
|
||||||
|
['signature', 'bases'],
|
||||||
|
PythonDefinitionDocumentationIncludeSections(
|
||||||
|
signature = False,
|
||||||
|
returns = False,
|
||||||
|
params = False,
|
||||||
|
exceptions = True,
|
||||||
|
examples = False,
|
||||||
|
docstring = False,
|
||||||
|
bases = False,
|
||||||
|
decorators = False,
|
||||||
|
class_body = True
|
||||||
|
)
|
||||||
|
),
|
||||||
|
(
|
||||||
|
None,
|
||||||
|
['params', 'docstring'],
|
||||||
|
PythonDefinitionDocumentationIncludeSections(
|
||||||
|
signature = True,
|
||||||
|
returns = True,
|
||||||
|
params = False,
|
||||||
|
exceptions = True,
|
||||||
|
examples = True,
|
||||||
|
docstring = False,
|
||||||
|
bases = True,
|
||||||
|
decorators = True,
|
||||||
|
class_body = True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
])
|
||||||
|
def test_parse_sections_list(include, exclude, expected):
|
||||||
|
assert parse_sections_list(include, exclude) == expected
|
||||||
|
|
||||||
def test_sections_error():
|
def test_sections_error():
|
||||||
parser = create_argument_parser()
|
parser = create_argument_parser()
|
||||||
|
|||||||
Reference in new issue
Block a user