python-asserts adheres to semantic versioning.
- Add support for Python 3.13 and 3.14.
- Add
assert_datetime_now().
- Fail with
AssertionError, notTypeError, if a timezone-aware datetime is passed toassert_datetime_about_now()orassert_datetime_about_now_utc(). - Modernize type annotations.
- Drop support for Python 3.8 and 3.9.
Fixed Python 3.12 deprecation warnings.
- Add support for Python 3.12.
- Add
PresentandAbsentfor absence checks inassert_json_subset().
- Drop support for Python 3.7.
- Deprecate
Existsin favor ofPresentandAbsentinassert_json_subset().
- Add
assert_not_regex().
- Modernize the type stubs.
- Drop support for Python 3.6.
assert_json_subset()can now check for the existence or non-existence of object members using the newExistshelper.- Non-string (or
Exists) object member names in the first argument toassert_json_subset()now raise aTypeError.
- Drop support for Python 2.7 and 3.5.
AssertRaisesContextandAssertWarnsContextnow return themselves when__enter__()is called. By extension it now easier to calladd_test()withassert_raises()et al:
with assert_raises(KeyError) as context:
context.add_test(...)
...- Add
AssertRaisesContext.exc_valproperty to access the caught exception after leaving the context manager:
with assert_raises(KeyError) as context:
...
assert_equal("expected message", str(context.exc_val))- Drop support for Python 3.4.
AssertRaisesContextand sub-classes are now generic over the exception type.
- Add
assert_json_subset().
- Add support for Python 3.7 (contributed by Frank Niessink).
- Add
assert_dict_equal(). - Add
assert_dict_superset().
assert_equal(): Useassert_dict_equal()if applicable.
fail()is now marked withNoReturnin type stub.
- Improve type annotations for Python 2.
- Fix type signature of
AssertRaisesContext.__exit__().
- Add a py.typed file to signal that this package supports type hints.
assert_raises_regex(): Handle exceptions without any message correctly.
- assert_count_equal(): Add
msg_fmtargument. - Add AssertRaisesErrnoContext, AssertRaisesRegexContext, and AssertWarnsRegexContext.
- Replace
msgargument withmsg_fmtin all assertions (exceptfail()). This allows you to customize error messages more easily than before, becauseformat()with appropriate keyword arguments is now called on these strings. See the documentation of individual assertions for the supported arguments. - Replace AssertRaisesContext.msg and AssertWarnsContext.msg with msg_fmt.
- assert_almost_equal(), assert_not_almost_equal(): Place msg_fmt as third argument.
- Add assert_not_almost_equal().
- assert_almost_equal(): Raise ValueError if diff <= 0.
- assert_almost_equal() would never fail if a delta was supplied and the second number was smaller than the first.
- Use fail() instead of raise AssertionError in a few assertions.
- Add assert_warns() and assert_warns_regex().
- Distribute a wheel.
- asserts is now a package, instead of a module.
- Add a stub file.
- Add assert_count_equal().
- Add assert_less(), assert_less_equal(), assert_greater(), and assert_greater_equal().
- Add assert_not_is_instance().
- assert_datetime_about_now()/assert_datetime_about_now_utc(): Handle comparison with None more gracefully.
- Add the LICENSE file to the distribution.
Initial release.