Skip to content

Conversation

@albi3ro
Copy link
Contributor

@albi3ro albi3ro commented Aug 11, 2025

Context:

While updating catalyst tests to run with both frontends, I was encountering this test:

    def test_array_conversion_failed(self):
        """Test failure at converting array to bool using Autograph."""

        @qjit(autograph=True)
        def workflow(x):
            n = jnp.array([[1], [2]])

            if n:
                y = x**2
            else:
                y = 0

            return y

        with pytest.raises(
            TypeError, match="Array with multiple elements is not a valid predicate"
        ):
            workflow(3)

Which made me realize we don't actually have a similar verification for program capture. This adds that verification in.

Description of the Change:

Checks that all the predicates are scalars.

Benefits:

Enhanced verification.

Possible Drawbacks:

More stuff to run.

Related GitHub Issues:

[sc-97523]

@codecov
Copy link

codecov bot commented Aug 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.68%. Comparing base (9e9b4fd) to head (26cc307).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8066      +/-   ##
==========================================
- Coverage   99.68%   99.68%   -0.01%     
==========================================
  Files         543      543              
  Lines       56227    56229       +2     
==========================================
+ Hits        56052    56053       +1     
- Misses        175      176       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

@SimoneGasperini SimoneGasperini left a comment

Choose a reason for hiding this comment

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

Looks good! 😃

@albi3ro albi3ro added this pull request to the merge queue Aug 12, 2025
Merged via the queue into master with commit 18c7fd8 Aug 12, 2025
55 checks passed
@albi3ro albi3ro deleted the capture-cond-truthy branch August 12, 2025 17:09
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.

4 participants