Skip to content

Draft: first steps to ensure agreement - #96

Open
pjljvandelaar wants to merge 12 commits into
cge-mainfrom
issue68
Open

Draft: first steps to ensure agreement#96
pjljvandelaar wants to merge 12 commits into
cge-mainfrom
issue68

Conversation

@pjljvandelaar

Copy link
Copy Markdown
Collaborator

First few restructurings to get agreement of the envisioned end goal

@pjljvandelaar
pjljvandelaar requested a review from jincge May 20, 2026 13:29
@pjljvandelaar pjljvandelaar self-assigned this May 20, 2026
@pjljvandelaar
pjljvandelaar marked this pull request as draft May 20, 2026 13:30
@pjljvandelaar
pjljvandelaar marked this pull request as ready for review May 29, 2026 12:22
@pjljvandelaar

Copy link
Copy Markdown
Collaborator Author

@jincge Please review.
After that, I would like to discuss
the architecture, the documentation structure (including concepts and features), the test architecture, etc.
such that we agree and can move forward together.

"""
Assert the expected (in)equivalence of a pair of nodes (AstProtocol).
"""
match (isinstance(a, Sequence), isinstance(b, Sequence)):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use '_eq' so that this can be used to compare between node in production also
and in test you can just do a== b or assert_that(a, equal_to(b)) directly

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not an assertion, it is structural pattern matching!

@pjljvandelaar pjljvandelaar Jul 8, 2026

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the code is in test/utils/ directory so is not intended for usage by production code.

@pytest.mark.parametrize(
"a, b, expected", make_parametersets_of_equivalence_classes("trivia", PATTERN_FACTORY.create_statements, TRIVIA_CLASSES)
)
def test_pairs_of_equivalence_classes(self, a: AstProtocol, b: AstProtocol, expected: bool):

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typehints are wrong - multiple statements are a Sequence of AstNode(s) not an AstNode.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why didn't pylint complain?
Check type hints of create_statements - it should be a sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants