--- id: asserts version: "0.14.0" license: unclear license_treatment: unclear maintenance: active --- # asserts — Stand-alone Assertions License: unclear · Maintenance: active · Downloads: 106.1K/mo ## What it is and what it does asserts is a lightweight library of assertion functions designed to work independently of unittest.TestCase. Instead of inheriting from TestCase to get assertion methods, you import assertion functions directly—useful in test classes that don't derive from TestCase, in mock and fake implementations, or as a richer alternative to Python's built-in assert statement. The library includes common assertions like assert_equal, assert_true, and assert_raises, all with customizable failure messages and PEP 8 compliance. The package trades away a couple of TestCase features (custom assertion classes and addTypeEqualityFunc support) for cleaner separation of concerns: your test runner handles test execution, and assertion functions handle validation. It depends only on typing-extensions and requires Python 3.10 or later. Use it for: - Write assertions in test classes that don't inherit from unittest.TestCase. - Add rich assertion checks to mock and fake object implementations. - Use assertions in production code as a more readable alternative to the assert statement. - Customize assertion failure messages with format strings for clearer test output. - Build custom assertion functions by extending the library's assertion patterns. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Provides stand-alone assertion functions for Python that work outside unittest.TestCase, suitable for test cases, mocks, fakes, and implementations with customizable failure messages. Yes, if you need stand-alone assertions outside unittest.TestCase. The package is actively maintained, has low install friction, and carries no known vulnerabilities. However, verify the license before use in proprietary contexts, and note that it is classified as Alpha—suitable for testing and development but not yet marked as stable. ## Install pip install asserts uv add asserts poetry add asserts ## Installing asserts Before you install: Low friction install with a single runtime dependency (typing-extensions). Active maintenance with a recent release (270 days ago) and ongoing repository activity. License in practice: License status is unclear—no SPDX identifier or raw license text is available in the package metadata. Verify the actual license before use in proprietary or restricted contexts. Quickstart: pip install asserts from asserts import assert_equal, assert_true, assert_raises assert_equal(13, 13) assert_true(True, msg="custom message") with assert_raises(KeyError): raise KeyError() Requires Python 3.10 or later. Verify before relying: - Whether the package is suitable for production use given its 'Alpha' development status classification. - What the actual license is, since license_treatment is marked unclear and no SPDX or raw license text is provided. ## Package facts - License: not declared (unclear) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 106.1K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags standalone assertions python, assert functions without unittest, custom assertion messages, assertion library testing, pep 8 assertions, mock assertion helpers, assert_equal assert_true assert_raises, testing, assertions, unittest-alternative [View on SkillFed](https://skillfed.io/packages/asserts) · [View on PyPI](https://pypi.org/project/asserts/)