{"id":15444747,"url":"https://github.com/tybruno/unittest_assertions","last_synced_at":"2025-04-19T20:37:42.195Z","repository":{"id":45381830,"uuid":"392376876","full_name":"tybruno/unittest_assertions","owner":"tybruno","description":"Thin wrapper around the python builtin unittest library allowing developers to use builtin assertions for non-unittest use cases.","archived":false,"fork":false,"pushed_at":"2021-12-16T14:57:39.000Z","size":242,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-03-15T10:50:01.064Z","etag":null,"topics":["assertify","functional-testing","python","unittest","verification","verify","wrapper"],"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/tybruno.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-03T16:12:45.000Z","updated_at":"2022-02-02T22:59:02.000Z","dependencies_parsed_at":"2022-08-31T12:41:39.944Z","dependency_job_id":null,"html_url":"https://github.com/tybruno/unittest_assertions","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tybruno%2Funittest_assertions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tybruno%2Funittest_assertions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tybruno%2Funittest_assertions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tybruno%2Funittest_assertions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tybruno","download_url":"https://codeload.github.com/tybruno/unittest_assertions/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249795194,"owners_count":21326776,"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":["assertify","functional-testing","python","unittest","verification","verify","wrapper"],"created_at":"2024-10-01T19:42:26.617Z","updated_at":"2025-04-19T20:37:42.175Z","avatar_url":"https://github.com/tybruno.png","language":"Python","readme":"[![Code Style](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/ambv/black)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blueviolet.svg)](https://opensource.org/licenses/MIT)\n[![Linting and Testing](https://github.com/tybruno/unittest_assertions/actions/workflows/linting-and-testing.yml/badge.svg)](https://github.com/tybruno/unittest_assertions/actions/workflows/linting-and-testing.yml)\n[![codecov](https://codecov.io/gh/tybruno/unittest_assertions/branch/main/graph/badge.svg?token=HPP1A6F39K)](https://codecov.io/gh/tybruno/unittest_assertions)\n\n# unittest_assertions\nThin wrapper around the python builtin `unittest` allowing developers to use the builtin assertions for non-unittest use cases.\n \n\n#### Key Features:\n* **Easy**: Designed to make it be simple allowing developers to use the builtin unittest assertions for their own use cases.\n* **Great Developer Experience**: Being fully typed, documented, and tested makes it great for editor support and extension.\n* **There is More!!!**:\n    * [assertify](https://github.com/tybruno/assertify): Simple, Flexible, and Extendable python3.6+ library to evaluate an expression and return `True`/`False` or raise an `AssertionError` or `Exception`.\n\n## Installation\n```bash\npip install unittest-assertions\n```\n## Examples\n```python\nfrom unittest_assertions.identity import AssertIsInstance\n\nassert_is_instance = AssertIsInstance(msg=\"Raised an AssertionError\")\nassert_is_instance(\"example str\", int) # raise AssertionError(\"'example str' is not an instance of \u003cclass 'int'\u003e : Raised an AssertionError\")\n```\n\n```python\nfrom unittest_assertions import AssertEqual\n\nassert_equal = AssertEqual()\nassert_equal(1, 1)\nassert_equal(first=\"hello\", second=\"hello\")\n```\n```python\nfrom unittest_assertions import AssertNotIn\nassert_in = AssertNotIn()\nassert_in(member=1, container=[5,2,3])\n```\n# Asserters\n## Container\n| Asserter | Expression |\n|-----------------|----------------|\n|AssertIn| `assert member in container`| \n| AssertNotIn| `assert member not in container` |\n\n## Control\n| Asserter | Expression |\n|-----------------|----------------|\n|AssertRaises| `assert function raises expected_exception` | \n|AssertWarns| `assert function warns expected_warning`| \n|AssertLogs| `assert logger(level)` | \n\n## Equality\n| Asserter | Expression | \n|-----------------|----------|\n|AssertEqual| `assert first == second`| \n|AssertNotEqual| `assert first != second` | \n|AssertAlmostEqual| `assert first ~= second` |\n|AssertNotAlmostEqual| `assert first !~= second` | \n|AssertCountEqual| `assert Counter(list(first) == Counter(list(second))`| \n|AssertMultilineEqual| `assert first.splitlines() == second.splitlines()` |\n|AssertSequenceEqual| `assert seq1 == seq2`| \n|AssertListEqual| `assert list1 == list2`| \n|AssertTupleEqual| `assert tuple1 == tuple2`| \n|AssertSetEqual| `assert set1 == set2` | \n|AssertDictEqual| `assert dict1 == dict2`| \n|AssertLess| `assert a \u003c b`| \n|AssertLessEqual| `assert a \u003c= b` | \n|AssertGreater| `assert a \u003e b` | \n|AssertGreater| `assert a \u003e= b` | \n\n## Identity\n| Asserter | Expression |\n|-----------------|----------------|\n|AssertTrue| `assert expr is True` |\n|AssertFalse| `assert expr is False` |\n|AssertIs| `assert exp1 is exp2`|\n|AssertIsNot| `assert exp1 is not exp2`| \n|AssertIsNone| `assert obj is None`|\n|AssertIsNotNone| `assert obj is not None`|\n|AssertIsInstance|`assert isinstance(obj,class)` |\n|AssertIsNotInstance| `assert not isinstance(obj,class)` | \n\n## Regex\n| Asserter | Expression | \n|-----------------|----------------|\n|AssertRaisesRegex| `assert expected_regex in expected_exception_message` |\n|AssertWarnsRegex| `assert expected_regex in expected_warning_message` | \n|AssertRegex| `assert text in expected_regex`| \n|AssertNotRegex| `assert text not in expected_regex`| ","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftybruno%2Funittest_assertions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftybruno%2Funittest_assertions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftybruno%2Funittest_assertions/lists"}