samuelcolvin/dirty-equals
Doing dirty (but extremely useful) things with equals. observed · 2026-09-03
Health v2 · maintenance only
75/100
- Activity 97
- Release rhythm 33
- Longevity 100
How is this computed?
round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10) — computed 2026-09-03. Adoption (stars, forks) is never an input.
- gap_med: 154.0
- age_days: 1680
- days_rel: 290
- days_push: 23
- n_releases_24m: 3
Adoption not part of the score
1004 stars · 54 forks observed · 2026-09-03
What it is AI-extracted, prompt v1, taxonomy v1, 2026-08-30, confidence not recorded
dirty-equals is a Python library that overloads __eq__ to provide declarative, partial-match assertion helpers for unit tests. It lets you compare values against matchers like IsPositiveInt, IsStr(regex=...), IsJson, and IsNow instead of exact values.
Use cases
- assert API response fields without knowing exact values
- test database row contents declaratively
- match strings against regexes in assertions
- compare JSON strings by decoded value
- check datetimes are close to now in tests
- partially match dicts and lists in pytest
When to choose
- writing pytest unit tests that assert on API responses or DB rows
- you want readable, declarative assertions with partial matching
- you need regex, type, or fuzzy datetime comparisons inside assert statements
When to avoid
- non-Python projects
- production code where magic __eq__ semantics would be confusing
- tests requiring strict exact-value equality only
Facets
library · maturity active
testing developer-tools testing developer-tools python cross-platform pytest unit-testing assertions declarative-tests matchers
3 sources
- readme: https://github.com/samuelcolvin/dirty-equals · fetched 2026-09-03 · e08357dbf42b
- homepage: https://dirty-equals.helpmanual.io · fetched 2026-08-29 · d78d824cb680
- registry_pypi: https://pypi.org/pypi/dirty-equals/json · fetched 2026-08-29 · 06efabf39edf
Member repositories
| Repository | Role | Health v2 |
|---|---|---|
| samuelcolvin/dirty-equals | main | 75 |
For agents
markdown · JSON · MCP: product_card(name="samuelcolvin/dirty-equals")
Data as of 2026-08-30T08:39:29.467469+00:00 · Report a problem