Add a unit test assertion method for bulk-checking object attributes.

Review Request #11318 — Created Dec. 7, 2020 and submitted — Latest diff uploaded

Information

Djblets
release-1.0.x

Reviewers

This introduces assertAttrsEqual(), an assertion method that takes an
object and a dictionary of attribute names and values and compares for
equality. If an attribute is missing or not of the expected value,
this will raise an exception.

The new method is useful for comparing the populated fields of an object
after creation or modification, improving readability and reducing
the maintenance burden.

Used this in some unit tests I'm building. Tested both error conditions
and the success condition.

Diff Revision 1 (Latest)

Commits

First Last Summary ID Author
Add a unit test assertion method for bulk-checking object attributes.
This introduces `assertAttrsEqual()`, an assertion method that takes an object and a dictionary of attribute names and values and compares for equality. If an attribute is missing or not of the expected value, this will raise an exception. The new method is useful for comparing the populated fields of an object after creation or modification, improving readability and reducing the maintenance burden.
d56f885dfef5821cb5de92e4be7a06738c453d28 Christian Hammond
djblets/testing/testcases.py
Loading...