Closed jackdewinter closed 1 week ago
This PR refactors the test suite for rule MD012 (multiple consecutive blank lines) and fixes a bug where blank lines separated by pragmas were not being properly handled. The changes include converting individual test functions into parameterized tests and adding new test cases for pragma-related scenarios.
classDiagram
class MarkdownScanner {
+invoke_main(arguments: List[str])
+assert_results(expected_output: str, expected_error: str, expected_return_code: int)
}
class pluginRuleTest {
+name: str
+source_file_name: str
+scan_expected_return_code: int
+scan_expected_output: str
}
class pluginConfigErrorTest {
+name: str
+use_strict_config: bool
+set_args: List[str]
+expected_error: str
}
class test_md012 {
+test_md012_scan(test: pluginRuleTest)
+test_md012_config(test: pluginConfigErrorTest)
}
MarkdownScanner --> pluginRuleTest
MarkdownScanner --> pluginConfigErrorTest
test_md012 --> pluginRuleTest
test_md012 --> pluginConfigErrorTest
note for test_md012 "Refactored to use parameterized tests for better maintainability"
classDiagram
class PluginScanContext {
}
class MarkdownToken {
+is_blank_line: bool
+line_number: int
}
class RuleMd012 {
-__last_blank_line: MarkdownToken
-__blank_line_count: int
+next_token(context: PluginScanContext, token: MarkdownToken)
-__check_for_excess_blank_lines(context: PluginScanContext)
}
RuleMd012 --> MarkdownToken
RuleMd012 --> PluginScanContext
note for RuleMd012 "Fixed handling of blank lines separated by pragmas"
Change | Details | Files |
---|---|---|
Refactored test suite to use parameterized tests |
|
test/rules/test_md012.py |
Fixed bug in blank line handling with pragmas |
|
pymarkdown/plugins/rule_md_012.py |
Updated documentation and metadata |
|
newdocs/src/changelog.md publish/coverage.json publish/test-results.json |
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 99.98%. Comparing base (
2a9931e
) to head (ecba0a5
). Report is 1 commits behind head on main.
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
https://github.com/jackdewinter/pymarkdown/issues/1208
Summary by Sourcery
Refactor MD012 rule tests to use parameterized tests and add new test cases. Fix issue with blank lines separated by pragmas not being recognized correctly. Update changelog to reflect the fix.
Bug Fixes:
Enhancements:
Documentation:
Tests: