-
Notifications
You must be signed in to change notification settings - Fork 90
Split tests/test_parser.py into tests/test_modest_parser.py, tests/test_lexbor_parser.py #202
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…parser.py` for better code organization and maintainability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This pull request separates the previously shared test suite for Selectolax parsers into two distinct test files: one for the deprecated Modest parser (test_modest_parser.py) and one for the Lexbor parser (test_lexbor_parser.py). This separation improves maintainability and clarifies the testing scope for each parser engine.
Key changes:
- Created dedicated test suite for Lexbor parser with engine-specific tests
- Refactored Modest parser tests to remove all Lexbor dependencies and parameterization
- Eliminated dual-parser test patterns in favor of single-parser focused tests
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| tests/test_modest_parser.py | Removed Lexbor imports, parameterized tests, and Lexbor-specific test cases; simplified all tests to use only HTMLParser |
| tests/test_lexbor_parser.py | New file containing comprehensive Lexbor parser tests including concurrency, Unicode handling, pseudo-class selectors, and error handling |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| def test_parser(parser): | ||
| html = parser("") | ||
| assert isinstance(html, parser) | ||
| def test_HTMLParser(): |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Function name uses PascalCase for 'HTMLParser' which is inconsistent with Python naming conventions. Consider renaming to 'test_html_parser' to follow snake_case convention for function names.
| def test_HTMLParser(): | |
| def test_html_parser(): |
| from selectolax.lexbor import LexborHTMLParser, LexborNode, SelectolaxError, create_tag | ||
|
|
||
| """ | ||
| We'are testing only our own code. |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'We'are' to 'We're'.
| We'are testing only our own code. | |
| We're testing only our own code. |
| from selectolax.lexbor import LexborHTMLParser, LexborNode, SelectolaxError, create_tag | ||
|
|
||
| """ | ||
| We'are testing only our own code. |
Copilot
AI
Dec 16, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Corrected spelling of 'We'are' to 'We're'.
| We'are testing only our own code. | |
| We're testing only our own code. |
|
You are duplicating tests for no apparent reason. |
Important
As modest is deprecated, these changes clarify the distinction between the two parser engines in the codebase and make the test suites easier to maintain.
This pull request splits and refactors the test suite for the Selectolax HTML parsers. It introduces a new, dedicated test file for the Lexbor parser (
test_lexbor_parser.py) and renames and updates the previous shared test file to focus exclusively on the Modest parser (test_modest_parser.py). The refactored tests for the Modest parser remove all references to the Lexbor parser, eliminate parameterized tests that previously ran against both engines, and simplify the test implementations.The most important changes are:
Test suite reorganization and separation:
test_lexbor_parser.pycontaining comprehensive tests specifically for the Lexbor parser, including tests for concurrency, Unicode handling, malformed data, and API edge cases.test_parser.pytotest_modest_parser.pyand refactored it to focus solely on the Modest parser (HTMLParser), removing all Lexbor-specific imports and logic.Refactoring and simplification of Modest parser tests:
HTMLParserinstead of supporting bothHTMLParserandLexborHTMLParser. [1] [2] [3] [4] [5] [6] [7] [8] [9] [10]Removal of Lexbor-specific tests from Modest suite:
These changes clarify the distinction between the two parser engines in the codebase and make the test suites easier to maintain.