{"id":15009883,"url":"https://github.com/srittau/python-asserts","last_synced_at":"2025-04-09T17:52:25.922Z","repository":{"id":14344656,"uuid":"17054231","full_name":"srittau/python-asserts","owner":"srittau","description":"Stand-alone Assertions for Python","archived":false,"fork":false,"pushed_at":"2024-04-08T06:44:43.000Z","size":268,"stargazers_count":12,"open_issues_count":5,"forks_count":0,"subscribers_count":6,"default_branch":"main","last_synced_at":"2024-04-08T07:47:23.025Z","etag":null,"topics":["assertions","python","python2","python3","testing","unittest","unittesting"],"latest_commit_sha":null,"homepage":"","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/srittau.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"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}},"created_at":"2014-02-21T11:18:09.000Z","updated_at":"2024-04-15T07:37:35.792Z","dependencies_parsed_at":"2023-02-10T14:30:19.269Z","dependency_job_id":"b9bf2e43-ec12-48c2-8c41-d2b1d52e2bb9","html_url":"https://github.com/srittau/python-asserts","commit_stats":{"total_commits":199,"total_committers":5,"mean_commits":39.8,"dds":0.2613065326633166,"last_synced_commit":"3b31dd721f08a19447a44d8095fe4f4ee6058ed0"},"previous_names":[],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-asserts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-asserts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-asserts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/srittau%2Fpython-asserts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/srittau","download_url":"https://codeload.github.com/srittau/python-asserts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247861199,"owners_count":21008443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["assertions","python","python2","python3","testing","unittest","unittesting"],"created_at":"2024-09-24T19:29:01.506Z","updated_at":"2025-04-09T17:52:25.901Z","avatar_url":"https://github.com/srittau.png","language":"Python","readme":"# Python Asserts\n\n[![License](https://img.shields.io/pypi/l/asserts.svg)](https://pypi.python.org/pypi/asserts/)\n[![PyPI - Python Version](https://img.shields.io/pypi/pyversions/asserts)](https://pypi.python.org/pypi/asserts/)\n[![GitHub](https://img.shields.io/github/release/srittau/python-asserts/all.svg)](https://github.com/srittau/python-asserts/releases/)\n[![pypi](https://img.shields.io/pypi/v/asserts.svg)](https://pypi.python.org/pypi/asserts/)\n[![GitHub Actions](https://img.shields.io/github/actions/workflow/status/srittau/python-asserts/test-and-lint.yml)](https://github.com/srittau/python-asserts/actions/workflows/test-and-lint.yml)\n\nStand-alone Assertions for Python\n\nThis package provides a few advantages over the assertions provided by\nunittest.TestCase:\n\n- Can be used stand-alone, for example:\n  - In test cases, not derived from TestCase.\n  - In fake and mock classes.\n  - In implementations as rich alternative to the assert statement.\n- PEP 8 compliance.\n- Custom stand-alone assertions can be written easily.\n- Arguably a better separation of concerns, since TestCase is responsible\n  for test running only, if assertion functions are used exclusively.\n\nThere are a few regressions compared to assertions from TestCase:\n\n- The default assertion class (`AssertionError`) can not be overwritten. This\n  is rarely a problem in practice.\n- asserts does not support the `addTypeEqualityFunc()` functionality.\n\nUsage:\n\n```python\n\u003e\u003e\u003e from asserts import assert_true, assert_equal, assert_raises\n\u003e\u003e\u003e my_var = 13\n\u003e\u003e\u003e assert_equal(13, my_var)\n\u003e\u003e\u003e assert_true(True, msg=\"custom failure message\")\n\u003e\u003e\u003e with assert_raises(KeyError):\n...     raise KeyError()\n```\n\nFailure messages can be customized:\n\n```python\n\u003e\u003e\u003e assert_equal(13, 14, msg_fmt=\"{got} is wrong, expected {expected}\")\nTraceback (most recent call last):\n  ...\nAssertionError: 14 is wrong, expected 13\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrittau%2Fpython-asserts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsrittau%2Fpython-asserts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsrittau%2Fpython-asserts/lists"}