Skip to main content

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.5.0.tar.gz (2.1 kB view details)

Uploaded Source

Built Distribution

pyariable-0.5.0-py3-none-any.whl (2.1 kB view details)

Uploaded Python 3

File details

Details for the file pyariable-0.5.0.tar.gz.

File metadata

  • Download URL: pyariable-0.5.0.tar.gz
  • Upload date:
  • Size: 2.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Darwin/20.6.0

File hashes

Hashes for pyariable-0.5.0.tar.gz
Algorithm Hash digest
SHA256 1e3c4bc232d18c4645ca8df13cd47f95ee82f371596f50433e67728ec35990c5
MD5 582f682581c2747b174796ca97569b21
BLAKE2b-256 f476e92590349a56fd80494456020bca5c9320d765b20efd198ffefd4ab81286

See more details on using hashes here.

File details

Details for the file pyariable-0.5.0-py3-none-any.whl.

File metadata

  • Download URL: pyariable-0.5.0-py3-none-any.whl
  • Upload date:
  • Size: 2.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.6 CPython/3.9.5 Darwin/20.6.0

File hashes

Hashes for pyariable-0.5.0-py3-none-any.whl
Algorithm Hash digest
SHA256 af51cb3a8e5d04d847227f47f446e575bf65f9f290db362817cb617eb677fa91
MD5 e221462b5a69b65cd15fd6691b9b93e7
BLAKE2b-256 79df09197813bdc2bc1ce451fa2c7383882ad8abdafcc0615916b57b5fb495b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page