Skip to content

g.md2man: Expand tests on other cases - #7679

Merged
echoix merged 3 commits into
OSGeo:mainfrom
echoix-org:ai-findings-autofix/utils-g.md2man-tests-g_md2man_test.py
Jul 13, 2026
Merged

echoix merged 3 commits into
OSGeo:mainfrom
echoix-org:ai-findings-autofix/utils-g.md2man-tests-g_md2man_test.py

Conversation

@echoix

@echoix echoix commented Jul 13, 2026

Copy link
Copy Markdown
Member

CodeQL Code Quality had some AI findings on a recently changed file, a test file for g.md2man. The tests suggested seemed legitimate, and they are passing. I am thus submitting them here, after testing them in my fork.

Original text explaining the findings:


The test asserts that there are exactly 3 bullet list markers for the input "- first\n- second\n - nested\n", but this input only has 3 items (first, second, nested). The assertion == 3 may be correct, but it should be verified that the nested item also produces the same .IP \(bu 4n marker, since nested items could produce a different marker format. If the nested list intentionally uses the same marker, this is fine, but the test name test_unordered_list_nested suggests the nesting behavior is what's being tested, and there is no assertion verifying that the nested item is actually rendered as nested (e.g., inside .RS/.RE blocks relative to the parent items). Consider adding an assertion that checks the order of .RS, .IP, and .RE to confirm correct nesting structure.


The test_comment_parsing_unit test covers multi-line and inline comments, but there is no unit test for strip_html_comments behavior inside a fenced code block (i.e., that a comment inside a fence is preserved). The integration test test_comment_kept_in_fenced_code covers this via subprocess, but a direct unit test of strip_html_comments with a fenced block containing a comment would provide more precise coverage of that branch in gmd.py.

echoix and others added 3 commits July 13, 2026 09:15
…ilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
…ilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
@echoix
echoix requested a review from petrasovaa July 13, 2026 08:26
@github-actions github-actions Bot added Python Related code is in Python tests Related to Test Suite labels Jul 13, 2026
@echoix
echoix enabled auto-merge (squash) July 13, 2026 09:52
@echoix
echoix merged commit 011921f into OSGeo:main Jul 13, 2026
27 checks passed
@github-actions github-actions Bot added this to the 8.6.0 milestone Jul 13, 2026
@echoix
echoix deleted the ai-findings-autofix/utils-g.md2man-tests-g_md2man_test.py branch July 13, 2026 14:31
echoix added a commit to wenzeslaus/grass that referenced this pull request Jul 14, 2026
CodeQL Code Quality had some AI findings on a recently changed file, a test file for g.md2man. The tests suggested seemed legitimate, and they are passing. I am thus submitting them here, after testing them in my fork.

Original text explaining the findings: 

-------

The test asserts that there are exactly 3 bullet list markers for the input `"- first\n- second\n - nested\n"`, but this input only has 3 items (first, second, nested). The assertion `== 3` may be correct, but it should be verified that the nested item also produces the same `.IP \(bu 4n` marker, since nested items could produce a different marker format. If the nested list intentionally uses the same marker, this is fine, but the test name `test_unordered_list_nested` suggests the nesting behavior is what's being tested, and there is no assertion verifying that the nested item is actually rendered as nested (e.g., inside `.RS`/`.RE` blocks relative to the parent items). Consider adding an assertion that checks the order of `.RS`, `.IP`, and `.RE` to confirm correct nesting structure.


----------

The `test_comment_parsing_unit` test covers multi-line and inline comments, but there is no unit test for `strip_html_comments` behavior inside a fenced code block (i.e., that a comment inside a fence is preserved). The integration test `test_comment_kept_in_fenced_code` covers this via subprocess, but a direct unit test of `strip_html_comments` with a fenced block containing a comment would provide more precise coverage of that branch in `gmd.py`.

* Apply suggested fix to utils/g.md2man/tests/g_md2man_test.py from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply suggested fix to utils/g.md2man/tests/g_md2man_test.py from Copilot Autofix

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>

* Apply ruff format

---------

Co-authored-by: Copilot Autofix powered by AI <223894421+github-code-quality[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Python Related code is in Python tests Related to Test Suite

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants