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] Add Property Tests for Intersection and Union #15415

Conversation

cake-monotone
Copy link
Contributor

@cake-monotone cake-monotone commented Jan 11, 2025

Summary

Closes #14986

stable tests

  • all_fully_static_type_pairs_are_subtype_of_their_union

flaky tests

  • negation_is_disjoint
  • all_fully_static_type_pairs_are_supertypes_of_their_union
  • all_type_pairs_can_be_assigned_from_their_intersection
  • all_type_pairs_are_assignable_to_their_union

The tests that are currently failing have been categorized as flaky. The failure of fully_static_types_are_supertypes_of_their_intersection seems a bit unusual, so I’ll take look into it and create a separate issue if needed. :)

Test Plan

stable: QUICKCHECK_TESTS=10000 cargo test -p red_knot_python_semantic -- --ignored types::property_tests::stable
flaky: QUICKCHECK_TESTS=10000 cargo test -p red_knot_python_semantic -- --ignored types::property_tests::flaky

Copy link
Contributor

github-actions bot commented Jan 11, 2025

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Brilliant, thank you!

@AlexWaygood AlexWaygood added testing Related to testing Ruff itself red-knot Multi-file analysis & type inference labels Jan 11, 2025
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

A couple of suggestions to also add some non-fully-static variations of these tests

Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

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

Thank you!

@AlexWaygood AlexWaygood enabled auto-merge (squash) January 12, 2025 13:17
@AlexWaygood AlexWaygood disabled auto-merge January 12, 2025 13:17
@AlexWaygood AlexWaygood enabled auto-merge (squash) January 12, 2025 13:17
@AlexWaygood AlexWaygood merged commit ccfde37 into astral-sh:main Jan 12, 2025
20 checks passed
sharkdp pushed a commit that referenced this pull request Jan 13, 2025
## Summary

Follow-up PR from #15415  🥲 

The exact same property test already exists:
`intersection_assignable_to_both` and
`all_type_pairs_can_be_assigned_from_their_intersection`

## Test Plan

`cargo test -p red_knot_python_semantic -- --ignored
types::property_tests::flaky`
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 testing Related to testing Ruff itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[red-knot] More useful property-tests based on trivia of set theory
2 participants