Placeholder variables to aid in testing.
Project description
Simplify your test assertions forever.
from pyariable import Variable
def test_dict():
x = Variable()
y = Variable()
assert {1: "XXX", 2: "XXX", 3: "YYY"} == {1: x, 2: x, 3: y}
assert x != y
In some tests it’s common to get a random ID back from a database. Your assertions are simpler when you substitute a Variable object for the expected value.
from pyariable import Variable
def test_list():
x = Variable()
y = Variable()
assert [
{"db_id": 590, "name": "alice"},
{"db_id": 590, "name": "bob"},
{"db_id": 999, "name": "charlie"},
] == [
{"db_id": x, "name": "alice"},
{"db_id": x, "name": "bob"},
{"db_id": y, "name": "charlie"},
]
assert x != y
assert x < y
Installation
pip install pyariable
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pyariable-0.1.0.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for pyariable-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8f2110f7448f2fa143b8ba0164595dbbb5e7262c34706a452621ea8e19998241 |
|
MD5 | 10b8d43aca2cbadfb451bded11f8533b |
|
BLAKE2b-256 | d17b5c261e9f413b99c407281812823b6a18ad2a341da61e001a21e11f83e1f1 |