Skip to content

Conversation

@JP-Ellis
Copy link
Contributor

📝 Summary

The AndMatcher allows for matchers to be combined. This is achieved in practice through the overloaded & operator.

🚨 Breaking Changes

🔥 Motivation

Not only is it useful, but it is also necessary for an upcoming fix to the matching rules serialisation.

🔨 Test Plan

None so far, but will be tested in upcoming PR.

🔗 Related issues/PRs

@JP-Ellis JP-Ellis self-assigned this Nov 19, 2025
Copilot AI review requested due to automatic review settings November 19, 2025 09:43
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR introduces an AndMatcher class that enables combining multiple matchers using logical AND operations, implemented through Python's & operator overloading. This feature is foundational for an upcoming fix to matching rules serialization.

Key Changes:

  • Added has_value() method to AbstractMatcher to check for value presence
  • Implemented __and__() operator overloading to combine matchers
  • Introduced AndMatcher class for managing combined matcher logic

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Nov 19, 2025

Codecov Report

❌ Patch coverage is 26.08696% with 17 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@98d1c19). Learn more about missing BASE report.
⚠️ Report is 2 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/pact/match/matcher.py 26% 17 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff           @@
##             main   #1348   +/-   ##
======================================
  Coverage        ?     51%           
======================================
  Files           ?      31           
  Lines           ?    3723           
  Branches        ?       0           
======================================
  Hits            ?    1935           
  Misses          ?    1788           
  Partials        ?       0           
Flag Coverage Δ
tests 51% <26%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

The `AndMatcher` allows for matchers to be combined. This is achieved in
practice through the overloaded `&` operator.

Signed-off-by: JP-Ellis <josh@jpellis.me>
@JP-Ellis JP-Ellis merged commit 7be0ff6 into main Nov 19, 2025
87 of 89 checks passed
@JP-Ellis JP-Ellis deleted the feat/and-matcher branch November 19, 2025 10:02
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.

2 participants