Skip to content

Comments

[red-knot] Add property tests for callable types#17006

Merged
dhruvmanila merged 4 commits intomainfrom
dhruv/callable-property-tests
Apr 1, 2025
Merged

[red-knot] Add property tests for callable types#17006
dhruvmanila merged 4 commits intomainfrom
dhruv/callable-property-tests

Conversation

@dhruvmanila
Copy link
Member

@dhruvmanila dhruvmanila commented Mar 27, 2025

Summary

Part of #15382, this PR adds property tests for callable types.

Specifically, this PR updates the property tests to generate an arbitrary signature for a general callable type which includes:

  • Arbitrary combination of parameter kinds in the correct order
  • Arbitrary number of parameters
  • Arbitrary optional types for annotation and return type
  • Arbitrary parameter names (no duplicate names), optional for positional-only parameters

Test Plan

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

Also, the commands in CI:

run: |
export QUICKCHECK_TESTS=100000
for _ in {1..5}; do
cargo test --locked --release --package red_knot_python_semantic -- --ignored list::property_tests
cargo test --locked --release --package red_knot_python_semantic -- --ignored types::property_tests::stable
done

@dhruvmanila dhruvmanila added the ty Multi-file analysis & type inference label Mar 27, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Mar 27, 2025

mypy_primer results

No ecosystem changes detected ✅

@dhruvmanila dhruvmanila force-pushed the dhruv/callable-property-tests branch from 59c23bf to d72b410 Compare March 27, 2025 15:45
@dhruvmanila

This comment was marked as resolved.

@dhruvmanila dhruvmanila force-pushed the dhruv/callable-property-tests branch from d72b410 to 949422d Compare March 31, 2025 14:04
@dhruvmanila dhruvmanila changed the base branch from main to dhruv/callable-disjoint March 31, 2025 14:04
@dhruvmanila dhruvmanila force-pushed the dhruv/callable-disjoint branch 2 times, most recently from ce725c5 to beb8d94 Compare March 31, 2025 16:06
@dhruvmanila dhruvmanila force-pushed the dhruv/callable-property-tests branch 2 times, most recently from 3b1bf94 to 3a5bb43 Compare March 31, 2025 19:11
@dhruvmanila

This comment was marked as resolved.

@dhruvmanila dhruvmanila force-pushed the dhruv/callable-disjoint branch 3 times, most recently from 60b3189 to 3544413 Compare April 1, 2025 18:51
Base automatically changed from dhruv/callable-disjoint to main April 1, 2025 19:00
@dhruvmanila dhruvmanila force-pushed the dhruv/callable-property-tests branch from 3a5bb43 to 7791ed1 Compare April 1, 2025 19:00
@dhruvmanila dhruvmanila marked this pull request as ready for review April 1, 2025 19:06
Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

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

Excellent!

@dhruvmanila dhruvmanila merged commit d38f6fc into main Apr 1, 2025
23 checks passed
@dhruvmanila dhruvmanila deleted the dhruv/callable-property-tests branch April 1, 2025 19:37
dcreager added a commit that referenced this pull request Apr 1, 2025
* main:
  [red-knot] Add property tests for callable types (#17006)
  [red-knot] Disjointness for callable types (#17094)
  [red-knot] Flatten `Type::Callable` into four `Type` variants (#17126)
  mdtest.py: do a full mdtest run immediately when the script is executed (#17128)
  [red-knot] Fix callable subtyping for standard parameters (#17125)
  [red-knot] Fix more `redundant-cast` false positives (#17119)
  Sync vendored typeshed stubs (#17106)
  [red-knot] support Any as a class in typeshed (#17107)
  Visit `Identifier` node as part of the `SourceOrderVisitor` (#17110)
  [red-knot] Don't infer Todo for quite so many tuple type expressions (#17116)
  CI: Run pre-commit on depot machine (#17120)
  Error instead of `panic!` when running Ruff from a deleted directory (#16903) (#17054)
  Control flow graph: setup (#17064)
  [red-knot] Playground improvements (#17109)
  [red-knot] IDE crate (#17045)
  Update dependency vite to v6.2.4 (#17104)
  [red-knot] Add redundant-cast error (#17100)
  [red-knot] Narrowing on `in tuple[...]` and `in str` (#17059)
Copy link
Contributor

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

Very nice!

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

Labels

ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants