Skip to content

Fix scalar Quantity pattern matching#964

Merged
teutoburg merged 1 commit into
mainfrom
teutoburg-patch-1
Jul 25, 2026
Merged

Fix scalar Quantity pattern matching#964
teutoburg merged 1 commit into
mainfrom
teutoburg-patch-1

Conversation

@teutoburg

@teutoburg teutoburg commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

This started occurring in the updated dependency tests today (which is good in a way, that's exactly why we run those tests!!) after skycalc_ipy 0.7.1 started allowing NumPy > 2.4. I traced it down to the structural pattern matching, which was changed in NumPy 2.5, and is now causing a scalar u.Quantity to fail matching for a 2-tuple. This used to work, because the structured pattern matching treated the u.Quantity as a single object, so didn't match the 2-tuple and went instead to the single value case. Flipping the case statements around won't work, because then an actual 2-tuple would match the single object already (actually Python is smart enough to raise a SyntaxError in tht case). The fix now checks for the single u.Quantity before, which seems to work.

I have some hope that Astropy 8.x will fix that again, we'll see...

@teutoburg teutoburg self-assigned this Jul 24, 2026
@teutoburg teutoburg added the bugfix PR resolving one or more bugs (use "Bug" type for issues, not this label) label Jul 24, 2026
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.60%. Comparing base (fbabb54) to head (b3a0aca).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #964   +/-   ##
=======================================
  Coverage   75.60%   75.60%           
=======================================
  Files          70       70           
  Lines        8981     8983    +2     
=======================================
+ Hits         6790     6792    +2     
  Misses       2191     2191           

☔ View full report in Codecov by Harness.
📢 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.

@teutoburg teutoburg moved this to 🏗 In progress in ScopeSim-development Jul 24, 2026
@teutoburg
teutoburg force-pushed the teutoburg-patch-1 branch from 86920ae to b3a0aca Compare July 24, 2026 13:36
@teutoburg
teutoburg marked this pull request as ready for review July 24, 2026 16:48
@teutoburg
teutoburg requested a review from a team July 24, 2026 16:49
@teutoburg teutoburg moved this from 🏗 In progress to 👀 Awaiting Review in ScopeSim-development Jul 24, 2026
@teutoburg
teutoburg enabled auto-merge July 24, 2026 17:55

@hugobuddel hugobuddel left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The churn of Python

@teutoburg
teutoburg merged commit 070069a into main Jul 25, 2026
46 of 47 checks passed
@teutoburg
teutoburg deleted the teutoburg-patch-1 branch July 25, 2026 07:40
@github-project-automation github-project-automation Bot moved this from 👀 Awaiting Review to ✅ Done in ScopeSim-development Jul 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bugfix PR resolving one or more bugs (use "Bug" type for issues, not this label)

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

2 participants