{"id":13533520,"url":"https://github.com/samuelcolvin/dirty-equals","last_synced_at":"2026-10-19T17:41:29.579Z","repository":{"id":36997180,"uuid":"452345017","full_name":"samuelcolvin/dirty-equals","owner":"samuelcolvin","description":"Doing dirty (but extremely useful) things with equals.","archived":false,"fork":false,"pushed_at":"2026-08-10T11:48:55.000Z","size":1609,"stargazers_count":1011,"open_issues_count":30,"forks_count":57,"subscribers_count":9,"default_branch":"main","last_synced_at":"2026-10-16T20:13:30.229Z","etag":null,"topics":["pytest","python","testing-tools","unit-testing"],"latest_commit_sha":null,"homepage":"https://dirty-equals.helpmanual.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/samuelcolvin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"claude":null,"gemini":null,"cursor":null,"copilot":null,"dco":null,"cla":null,"disclosure":null},"funding":{"github":"samuelcolvin"}},"created_at":"2022-01-26T16:10:05.000Z","updated_at":"2026-10-16T19:14:04.000Z","dependencies_parsed_at":"2026-08-19T09:43:07.864Z","dependency_job_id":null,"html_url":"https://github.com/samuelcolvin/dirty-equals","commit_stats":{"total_commits":133,"total_committers":18,"mean_commits":7.388888888888889,"dds":"0.18796992481203012","last_synced_commit":"065162ac195964df7f5c47288561809e49deac48"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"purl":"pkg:github/samuelcolvin/dirty-equals","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fdirty-equals","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fdirty-equals/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fdirty-equals/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fdirty-equals/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/samuelcolvin","download_url":"https://codeload.github.com/samuelcolvin/dirty-equals/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/samuelcolvin%2Fdirty-equals/sbom","scorecard":{"id":798334,"data":{"date":"2025-08-11","repo":{"name":"github.com/samuelcolvin/dirty-equals","commit":"31ab5a3b6141106919058c19dc41f0d4e9107d22"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":4.8,"checks":[{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":4,"reason":"Found 13/30 approved changesets -- score normalized to 4","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":2,"reason":"2 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 2","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/ci.yml:1","Warn: topLevel 'statuses' permission set to 'write': .github/workflows/upload-previews.yml:9","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Pinned-Dependencies","score":0,"reason":"dependency not pinned by hash detected -- score normalized to 0","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:118: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:122: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:125: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:148: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:165: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:168: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:177: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:185: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:34: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:37: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:48: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:57: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:59: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:65: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:74: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:77: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/ci.yml:94: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/ci.yml:106: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/ci.yml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/upload-previews.yml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/upload-previews.yml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/upload-previews.yml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/samuelcolvin/dirty-equals/upload-previews.yml/main?enable=pin","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:174","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:43","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:64","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:83","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:87","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:131","Warn: pipCommand not pinned by hash: .github/workflows/ci.yml:134","Warn: pipCommand not pinned by hash: .github/workflows/upload-previews.yml:22","Warn: pipCommand not pinned by hash: .github/workflows/upload-previews.yml:23","Info:   0 out of  13 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   7 third-party GitHubAction dependencies pinned","Info:   0 out of   9 pipCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":-1,"reason":"internal error: error during branchesHandler.setup: internal error: githubv4.Query: Resource not accessible by integration","details":null,"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Packaging","score":10,"reason":"packaging workflow detected","details":["Info: Project packages its releases by way of GitHub Actions.: .github/workflows/ci.yml:155"],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 24 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}}]},"last_synced_at":"2025-08-23T09:39:44.277Z","repository_id":36997180,"created_at":"2025-08-23T09:39:44.277Z","updated_at":"2025-08-23T09:39:44.277Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":344836268,"owners_count":38332221,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-10-03T21:59:58.778Z","status":"online","status_checked_at":"2026-10-16T02:00:06.653Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pytest","python","testing-tools","unit-testing"],"created_at":"2024-08-01T07:01:20.627Z","updated_at":"2026-10-19T17:41:29.565Z","avatar_url":"https://github.com/samuelcolvin.png","language":"Python","funding_links":["https://github.com/sponsors/samuelcolvin"],"categories":["Python","Assertions","Data Validation"],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://dirty-equals.helpmanual.io\"\u003e\n    \u003cimg src=\"https://dirty-equals.helpmanual.io/latest/img/logo-text.svg\" alt=\"dirty-equals\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003cem\u003eDoing dirty (but extremely useful) things with equals.\u003c/em\u003e\n\u003c/p\u003e\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/samuelcolvin/dirty-equals/actions/workflows/ci.yml?query=event%3Apush+branch%3Amain+workflow%3ACI\"\u003e\u003cimg src=\"https://github.com/samuelcolvin/dirty-equals/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://codecov.io/gh/samuelcolvin/dirty-equals\"\u003e\u003cimg src=\"https://codecov.io/gh/samuelcolvin/dirty-equals/branch/main/graph/badge.svg\" alt=\"Coverage\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://pypi.python.org/pypi/dirty-equals\"\u003e\u003cimg src=\"https://img.shields.io/pypi/v/dirty-equals.svg\" alt=\"pypi\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/samuelcolvin/dirty-equals\"\u003e\u003cimg src=\"https://img.shields.io/pypi/pyversions/dirty-equals.svg\" alt=\"versions\"\u003e\u003c/a\u003e\n  \u003ca href=\"https://github.com/samuelcolvin/dirty-equals/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/samuelcolvin/dirty-equals.svg\" alt=\"license\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n---\n\n**Documentation**: [dirty-equals.helpmanual.io](https://dirty-equals.helpmanual.io)\n\n**Source Code**: [github.com/samuelcolvin/dirty-equals](https://github.com/samuelcolvin/dirty-equals)\n\n---\n\n**dirty-equals** is a python library that (mis)uses the `__eq__` method to make python code (generally unit tests)\nmore declarative and therefore easier to read and write.\n\n*dirty-equals* can be used in whatever context you like, but it comes into its own when writing unit tests for\napplications where you're commonly checking the response to API calls and the contents of a database.\n\n## Usage\n\nHere's a trivial example of what *dirty-equals* can do:\n\n```py\nfrom dirty_equals import IsPositive\n\nassert 1 == IsPositive\nassert -2 == IsPositive  # this will fail!\n```\n\n**That doesn't look very useful yet!**, but consider the following unit test code using *dirty-equals*:\n\n```py title=\"More Powerful Usage\"\nfrom dirty_equals import IsJson, IsNow, IsPositiveInt, IsStr\n\n...\n\n# user_data is a dict returned from a database or API which we want to test\nassert user_data == {\n    # we want to check that id is a positive int\n    'id': IsPositiveInt,\n    # we know avatar_file should be a string, but we need a regex as we don't know whole value\n    'avatar_file': IsStr(regex=r'/[a-z0-9\\-]{10}/example\\.png'),\n    # settings_json is JSON, but it's more robust to compare the value it encodes, not strings\n    'settings_json': IsJson({'theme': 'dark', 'language': 'en'}),\n    # created_ts is datetime, we don't know the exact value, but we know it should be close to now\n    'created_ts': IsNow(delta=3),\n}\n```\n\nWithout *dirty-equals*, you'd have to compare individual fields and/or modify some fields before comparison -\nthe test would not be declarative or as clear.\n\n*dirty-equals* can do so much more than that, for example:\n\n* [`IsPartialDict`](https://dirty-equals.helpmanual.io/types/dict/#dirty_equals.IsPartialDict)\n  lets you compare a subset of a dictionary\n* [`IsStrictDict`](https://dirty-equals.helpmanual.io/types/dict/#dirty_equals.IsStrictDict)\n  lets you confirm order in a dictionary\n* [`IsList`](https://dirty-equals.helpmanual.io/types/sequence/#dirty_equals.IsList) and\n  [`IsTuple`](https://dirty-equals.helpmanual.io/types/sequence/#dirty_equals.IsTuple)\n  lets you compare partial lists and tuples, with or without order constraints\n* nesting any of these types inside any others\n* [`IsInstance`](https://dirty-equals.helpmanual.io/types/other/#dirty_equals.IsInstance)\n  lets you simply confirm the type of an object\n* You can even use [boolean operators](https://dirty-equals.helpmanual.io/usage/#boolean-logic)\n  `|` and `\u0026` to combine multiple conditions\n* and much more...\n\n## Installation\n\nSimply:\n\n```bash\npip install dirty-equals\n```\n\n**dirty-equals** requires **Python 3.9+**.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelcolvin%2Fdirty-equals","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsamuelcolvin%2Fdirty-equals","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsamuelcolvin%2Fdirty-equals/lists"}