Registry / testing / re-assert

re-assert

JSON →
library1.1.0pypypi✓ verified 85d ago

A library to show where your regex match assertion failed. It provides a helper to clarify regex failures in tests. Current version: 1.1.0, release cadence: low, maintained by asottile.

pip install re-assert
INSTALL
IMPORT
SIG · RE-ASSERT
R
re-assert
testingpythonv1.1.0
Install
2.2s avg
Import
Disk
19MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.1.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 20.5MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 2.2s · import 0.000s · 21MB
19MB installed
● package 19MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

Matches
from re_assert import Matches
from re_assert import ReAssert
Pattern
from re_assert import Pattern
regex
from re_assert import regex

Basic usage: create a ReAssert object with a regex pattern, then compare with a string. If match fails, it prints where and why.

from re_assert import ReAssert # Pattern with group names pattern = r"(?P<name>\w+) (?P<age>\d+)" matcher = ReAssert(pattern) # This assertion will fail with a detailed message # matcher == 'John 30 extra' # Uncomment to see error: matcher == 'John 30' (this matches)
Debug
Known issues
gotchaReAssert uses __eq__ to perform matching. Ensure you are comparing the ReAssert object to a string, not the other way around.
fix
Use 'matcher == string' pattern.
affects: all
gotchaThe library is designed for testing; it does not raise exceptions but returns False and prints diagnostic info. Do not use it for production regex validation without assertions.
fix
Use in test suites with pytest or unittest.
affects: all
Upgrade
Version history
1.1.0latest on PyPI · released Feb 25, 2020
Audit
Dependencies

No dependency data recorded yet.

Agent activity
8 hits · last 30 days
node
8
Resources
re-assert — pip install re-assert · libregistry