Skip to content

Conversation

@vicky-dx
Copy link

@vicky-dx vicky-dx commented Dec 2, 2025

Summary

This PR adds test coverage for using compiled regex patterns (re.Pattern objects) with the match parameter in pytest.raises(). While this functionality already works, it wasn't explicitly tested.

Changes

  • Added test_raises_match_compiled_regex() in testing/python/raises.py
  • Tests three scenarios:
    1. Compiled regex pattern that matches
    2. Compiled regex pattern that doesn't match (verifies error message)
    3. Compiled regex with flags (e.g., re.IGNORECASE)

Checklist

  • Include new tests or update existing tests when applicable.
  • Allow maintainers to push and squash when merging my commits.
  • Create a new changelog file in the changelog folder (will add after PR number is assigned)
  • Add yourself to AUTHORS in alphabetical order.

Notes

This is a test coverage improvement that ensures the existing functionality for compiled regex patterns remains stable in future releases.

@psf-chronographer psf-chronographer bot added the bot:chronographer:provided (automation) changelog entry is part of PR label Dec 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot:chronographer:provided (automation) changelog entry is part of PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant