{"repo":"samuelcolvin/dirty-equals","free":true,"listed":false,"github":"https://github.com/samuelcolvin/dirty-equals","clone":"git clone https://github.com/samuelcolvin/dirty-equals.git","description":"Doing dirty (but extremely useful) things with equals.","language":"Python","stars":1004,"topics":["python","pytest","unit-testing","testing-tools"],"license":"MIT","category":"dev-tools","readme_excerpt":"Doing dirty (but extremely useful) things with equals. --- Documentation : dirty-equals.helpmanual.io Source Code : github.com/samuelcolvin/dirty-equals --- dirty-equals is a python library that (mis)uses the eq method to make python code (generally unit tests) more declarative and therefore easier to read and write. dirty-equals can be used in whatever context you like, but it comes into its own when writing unit tests for applications where you're commonly checking the response to API calls and the contents of a database. Usage Here's a trivial example of what dirty-equals can do: That doesn't look very useful yet! , but consider the following unit test code using dirty-equals : Without dirty-equals , you'd have to compare individual fields and/or modify some fields before comparison - the test would not be declarative or as clear. dirty-equals can do so much more than that, for example: IsPartialDict lets you compare a subset of a dictionary IsStrictDict lets you confirm order in a dictionary IsList and IsTuple lets you compare partial lists and tuples, with or without order constraints nesting any of these types inside any others IsInstance lets you simply confirm the type of an object You can even use boolean operators and & to combine multiple conditions and much more... Installation Simply: dirty-equals requires Python 3.9+ .","default_branch":null,"files":null,"tree":[],"storefront":"/r/samuelcolvin","claimed":false,"request_supported":{"post":"https://gitbuyer.com/r/samuelcolvin/dirty-equals/request-supported","requests":0},"note":"indexed from public GitHub; nothing is for sale on this page. Clone it from GitHub. Paid listings live at /search."}