Utilities to aid in testing for equality.
Project description
Help with failing asserts like
```
assert actual == {
'id': 123,
'field1': 1,
...
}
```
Where 'id' is generated by the database and is different every test run.
Fix this using 'AnyInt':
```
assert actual == {
'id': AnyInt(),
'field1': 1,
...
}
```
Instances of AnyInt compare equal to any integer. So this assertion will
now pass if and only if the value of the 'id' field is an int.
There are other classes for use in other situations.
Dependencies
------------
Written on Python 2.7 (sorry),
but it's a bug if it doesn't work on 3 as well.
Install
-------
::
pip install equality
Plans
-----
Slowly add occasional new classes as the need arises.
Known Problems
--------------
It's hot of the presses, so is doubtless full of mistakes.
Alternatives
------------
This doubtless duplicates better work elsewhere. Let me know and I'll
happily delete this project.
Thanks
------
To all the good folks formerly of Resolver Systems.
Contact
-------
:For users: Downloads & documentation:
http://pypi.python.org/pypi/equality/
:For developers: Souce code & issues:
https://github.com/tartley/equality/
:Contact the author:
Jonathan Hartley, email: tartley at domain tartley.com, Twitter: @tartley.
```
assert actual == {
'id': 123,
'field1': 1,
...
}
```
Where 'id' is generated by the database and is different every test run.
Fix this using 'AnyInt':
```
assert actual == {
'id': AnyInt(),
'field1': 1,
...
}
```
Instances of AnyInt compare equal to any integer. So this assertion will
now pass if and only if the value of the 'id' field is an int.
There are other classes for use in other situations.
Dependencies
------------
Written on Python 2.7 (sorry),
but it's a bug if it doesn't work on 3 as well.
Install
-------
::
pip install equality
Plans
-----
Slowly add occasional new classes as the need arises.
Known Problems
--------------
It's hot of the presses, so is doubtless full of mistakes.
Alternatives
------------
This doubtless duplicates better work elsewhere. Let me know and I'll
happily delete this project.
Thanks
------
To all the good folks formerly of Resolver Systems.
Contact
-------
:For users: Downloads & documentation:
http://pypi.python.org/pypi/equality/
:For developers: Souce code & issues:
https://github.com/tartley/equality/
:Contact the author:
Jonathan Hartley, email: tartley at domain tartley.com, Twitter: @tartley.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
equality-0.0.2.tar.gz
(4.6 kB
view details)
Built Distribution
File details
Details for the file equality-0.0.2.tar.gz
.
File metadata
- Download URL: equality-0.0.2.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eab61065928f61267f942e56b898408bb0ba0a6ddf450e975879a4151c2c1e34 |
|
MD5 | ead5b28abb26d6dd647b51e32add0e79 |
|
BLAKE2b-256 | f5a0d2f3739d7d4cdfb79820bfdbc06e20bc99a592c7f200d283d92088882396 |
File details
Details for the file equality-0.0.2-py2.py3-none-any.whl
.
File metadata
- Download URL: equality-0.0.2-py2.py3-none-any.whl
- Upload date:
- Size: 5.0 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb33be26a8688f6081e0c7276cd54feeebe6e04bf071f0c1220415004655c3cc |
|
MD5 | bab3410f5457bee5f8936462baceba53 |
|
BLAKE2b-256 | fb6d5d6331c5d39b557c97266aa8c003729e806af130681352e7a2b86bed4d66 |