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.3.1.tar.gz
(2.0 kB
view details)
File details
Details for the file pyariable-0.3.1.tar.gz
.
File metadata
- Download URL: pyariable-0.3.1.tar.gz
- Upload date:
- Size: 2.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: Python-urllib/3.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f2dd69cc27ddd9553fb0e0dfe21409cfc71abd8f57f8ffeebd520e5d23ff8bd1 |
|
MD5 | d428da68c975106b0d093783c79734cc |
|
BLAKE2b-256 | 76921f2f36dede762e1e1e6f9bdd2dc347debd5fa359c7469b9fd32d1856f649 |