Skip to content

Allow inject to compose with parameterize#1650

Open
Probablism wants to merge 1 commit into
apache:mainfrom
Probablism:fix-inject-parameterize
Open

Allow inject to compose with parameterize#1650
Probablism wants to merge 1 commit into
apache:mainfrom
Probablism:fix-inject-parameterize

Conversation

@Probablism

@Probablism Probablism commented Jun 27, 2026

Copy link
Copy Markdown

Fixes #160.

This updates expander resolution so @inject can run before regular expanders such as @parameterize. That lets an injected dependency be available when the parameterized function variants are created.

Changes

  • Add a pre-expander pass for expanders that need to run before regular node expansion.
  • Mark @inject as a pre-expander while keeping the existing single regular expander restriction.
  • Validate that injected target parameters do not overlap with parameters consumed by regular parameterization.
  • Add regression coverage for both decorator orders and the overlapping-parameter failure case.

How I tested this

  • tests/function_modifiers/test_expanders.py passed locally.
  • The main package test suite passed locally: 1446 passed, 5 skipped, 2 xpassed.
  • Static lint/format checks passed locally.
  • Fork GitHub Actions Unit Tests passed on fix-inject-parameterize across Python 3.10 through 3.14.

Notes

  • No user-facing documentation changes were needed; this is a decorator composition bug fix.

Checklist

  • PR has an informative and human-readable title (this will be pulled into the release notes)
  • Changes are limited to a single goal (no scope creep)
  • Code passed the pre-commit check & code is left cleaner/nicer than when first encountered.
  • Any change in functionality is tested
  • New functions are documented (with a description, list of inputs, and expected output)
  • Placeholder code is flagged / future TODOs are captured in comments
  • Project documentation has been updated if adding/changing functionality.

@Probablism Probablism marked this pull request as ready for review June 27, 2026 16:20
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.

Can't stack @inject and @parameterize decorators

1 participant