Skip to main content

comparable_pattern

A comparable string / regex object for flexible string comparisons.

Useful for making unit tests less brittle without extensive mocking of things like timestamps and hashes which maybe change from one run to another.

Examples

>>> p = compile("foo")
>>> c = ComparablePattern(p)
>>> p == "foo"
False
>>> c == "foo"
True
>>> c == "bar"
False

>>> c = "foo" + ComparablePattern(compile("\d{3}"))
>>> c == "foo"
False
>>> c == "123"
False
>>> c == "foo123"
True

>>> c = ComparablePattern(compile("\d{3}")) + "bar"
>>> c == "bar"
False
>>> c == "123"
False
>>> c == "123bar"
True

>>> c = ComparablePattern(compile("\d{3}")) + ComparablePattern(compile("\w{3}"))
>>> c == "123"
False
>>> c == "abc"
False
>>> c == "123abc"
True

Metadata

Release files for comparable-pattern 0.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for comparable-pattern 0.0.4
File Size Uploaded
comparable_pattern-0.0.4.tar.gz 5.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for comparable-pattern 0.0.4
File Interpreter ABI Platform
comparable_pattern-0.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / comparable_pattern-0.0.4.tar.gz

Download URL comparable_pattern-0.0.4.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
36caea8c4cc89a3a6cf023836bc120ef0ab69713face58917077c5a0cb2a2ebc
BLAKE2b-256 checksum
How to use checksums
52dcfdc137781d6882ebb086c69c31de68161a53ad8bacc9e188c497a247ea5a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release files / comparable_pattern-0.0.4-py3-none-any.whl

Download URL comparable_pattern-0.0.4-py3-none-any.whl
Size 4.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0e88c788d1f932ed65090eaa35ad7561fd76dd3e292a9b153f329f7eda9e218a
BLAKE2b-256 checksum
How to use checksums
20799d1f6561bb2b9755a8485d75cb39b9be37f088d1e83351deabc209d4fbe6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/5.0.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.0.4 This release

2 release files

0.0.3

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page