test_guard_python_file_docstring.py

tests/guard/test_guard_python_file_docstring.py

A Python module docstring is read whole as the file block (2.1).

test_a_docstring_missing_a_tag_is_still_reported

None test_guard_python_file_docstring.test_a_docstring_missing_a_tag_is_still_reported()

Reading the whole docstring must not make the check vacuous.

tests/guard/test_guard_python_file_docstring.py:34

Checks

  • assert messages == ["File-level doxygen missing @version tag in 'x.py'"]

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_a_docstring_missing_a_tag_is_still_reported → check_file_presence
REQ-DDB-GUARD-019measuredtest_a_docstring_missing_a_tag_is_still_reported → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_a_docstring_missing_a_tag_is_still_reported → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 7 lines
def test_a_docstring_missing_a_tag_is_still_reported() -> None:
    """@brief Reading the whole docstring must not make the check vacuous."""
    source = '"""Summary.\n\n@file x.py\n@brief Does x.\n"""\n'
    messages = [v.message for v in check_file_presence("x.py", source, _CONFIG)]
    assert messages == ["File-level doxygen missing @version tag in 'x.py'"]

Activity · 3 steps
lines 36–36source = '"""Summary.\n\n@file x.py\n@brief Does x.\n"""\n'lines 37–37messages = [v.message for v in check_file_presence("x.py", source, _CONFIG)]lines 38–38assert messages == ["File-level doxygen missing @version tag in 'x.py'"]

test_a_one_line_docstring_is_one_block

None test_guard_python_file_docstring.test_a_one_line_docstring_is_one_block()

Opened and closed on one line.

tests/guard/test_guard_python_file_docstring.py:41

Checks

  • assert check_file_presence("x.py", source, _CONFIG) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_a_one_line_docstring_is_one_block → check_file_presence
REQ-DDB-GUARD-019measuredtest_a_one_line_docstring_is_one_block → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_a_one_line_docstring_is_one_block → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 4 lines
def test_a_one_line_docstring_is_one_block() -> None:
    """@brief Opened and closed on one line."""
    source = '"""@file x.py @brief Does x. @version 1"""\nimport os\n'
    assert check_file_presence("x.py", source, _CONFIG) == []

1 more lines, not shown

Activity · 2 steps
lines 43–43source = '"""@file x.py @brief Does x. @version 1"""\nimport os\n'lines 44–44assert check_file_presence("x.py", source, _CONFIG) == []

test_tags_after_a_blank_line_in_a_module_docstring_count

None test_guard_python_file_docstring.test_tags_after_a_blank_line_in_a_module_docstring_count()

The block runs to the closing quotes.

tests/guard/test_guard_python_file_docstring.py:28

Checks

  • assert check_file_presence("x.py", source, _CONFIG) == []

Result: passed

Verifies

requirementlinkedpath to the implementer
REQ-DDB-GUARD-006measuredtest_tags_after_a_blank_line_in_a_module_docstring_count → check_file_presence
REQ-DDB-GUARD-019measuredtest_tags_after_a_blank_line_in_a_module_docstring_count → check_file_presence → _check_file_block_tags → parse_doxygen_tags
REQ-DDB-GUARD-024inferredtest_tags_after_a_blank_line_in_a_module_docstring_count → check_file_presence → _check_file_block_tags → apply_autobrief
Source · 6 lines
def test_tags_after_a_blank_line_in_a_module_docstring_count() -> None:
    """@brief The block runs to the closing quotes."""
    source = '"""Summary.\n\n@file x.py\n@brief Does x.\n@version 1.0\n"""\n\nimport os\n'
    assert check_file_presence("x.py", source, _CONFIG) == []

Activity · 2 steps
lines 30–30source = '"""Summary.\n\n@file x.py\n@brief Does x.\n@version 1.0\n"""\n\nimport os\n'lines 31–31assert check_file_presence("x.py", source, _CONFIG) == []