Skip to content
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

[red-knot] 'is_equivalent_to' is an equivalence relation #15488

Merged
merged 1 commit into from
Jan 15, 2025

Conversation

sharkdp
Copy link
Contributor

@sharkdp sharkdp commented Jan 15, 2025

Summary

Adds two additional tests for is_equivalent_to so that we cover all properties of an equivalence relation.

Test Plan

while cargo test --release -p red_knot_python_semantic -- --ignored types::property_tests::stable; do :; done

Adds two additional tests for `is_equivalent_to` so that we cover all
properties of an [equivalence relation].

[equivalence relation]: https://en.wikipedia.org/wiki/Equivalence_relation
@sharkdp sharkdp added the red-knot Multi-file analysis & type inference label Jan 15, 2025
@@ -365,7 +378,7 @@ mod flaky {

// For two fully static types, their intersection must be a subtype of each type in the pair.
type_property_test!(
all_fully_static_type_pairs_are_supertypes_of_their_union, db,
all_fully_static_type_pairs_are_supertypes_of_their_intersection, db,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unrelated minor fix.

Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@MichaReiser MichaReiser removed their request for review January 15, 2025 08:20
@sharkdp sharkdp merged commit d486284 into main Jan 15, 2025
21 checks passed
@sharkdp sharkdp deleted the david/equivalent_to-property-tests branch January 15, 2025 08:25
// Transitivity: If `S` is equivalent to `T` and `T` is equivalent to `U`, then `S` must be equivalent to `U`.
type_property_test!(
equivalent_to_is_transitive, db,
forall types s, t, u. s.is_equivalent_to(db, t) && t.is_equivalent_to(db, u) => s.is_equivalent_to(db, u)
Copy link
Member

Choose a reason for hiding this comment

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

I love the syntax of these property tests!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
red-knot Multi-file analysis & type inference
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants