A utility package for making better test assertions
Project description
Asserty
Asserty is a utility package that provides methods for better assertion in testing.
Installation
The package can be installed using pip
:
$ pip install asserty
Examples
You make assertions by importing the assert_that
function from the asserty
package:
from asserty import assert_that
assert_that("str").not_equals("string")
assert_that(5).is_in(range(10))
def myfunc(arg):
if not isinstance(arg, str):
raise TypeError()
return arg+"yay"
assert_that(myfunc).if_called_with(1).raises(TypeError)
assert_that(myfunc).if_called_with("Hey-").returns("Hey-yay")
Outside a test context that does not handle AssertionError
you can import the equivalent function called that
:
from asserty import that
assert that("str").not_equals("string")
assert that(5).is_in(range(10))
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
asserty-3.0.0.tar.gz
(6.8 kB
view details)
Built Distribution
File details
Details for the file asserty-3.0.0.tar.gz
.
File metadata
- Download URL: asserty-3.0.0.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e357c854db41b7e3adfededc9c8c03754d22d4723d92c4e5119c378dfae7b19a
|
|
MD5 |
9d15ee323dc70849d4ef89489587fcfa
|
|
BLAKE2b-256 |
3e695efb818c5b787a5686cc20d47c5f47b6a6ab1819f3d14c5118d93475766f
|
File details
Details for the file asserty-3.0.0-py3-none-any.whl
.
File metadata
- Download URL: asserty-3.0.0-py3-none-any.whl
- Upload date:
- Size: 7.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9f90cebed0e93f537683050938f1b046832f6158b5af2f0d5fa7f611af583725
|
|
MD5 |
02ee42102bcbe37e267dc4b21175f5fd
|
|
BLAKE2b-256 |
10e87e25b9615af8e6641a4bc338fe440ac14775989e22c14a89b06f775fce6b
|