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

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyariable-0.9.0-py3-none-any.whl (2.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pyariable-0.9.0.tar.gz
  • Upload date:
  • Size: 2.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.7 Darwin/25.0.0

File hashes

Hashes for pyariable-0.9.0.tar.gz
Algorithm Hash digest
SHA256 0b6ddc90bfdd60de122df922c3d0bd876116a85c93615db1a22c8daae8a972b9
MD5 e9e7de3f8801ae516191cd669f96ca3a
BLAKE2b-256 c892d8dc4162b46c4f4ca79d99fe7d49b82341d39d19702ee677d5b794f5bffb

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pyariable-0.9.0-py3-none-any.whl
  • Upload date:
  • Size: 2.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.12.7 Darwin/25.0.0

File hashes

Hashes for pyariable-0.9.0-py3-none-any.whl
Algorithm Hash digest
SHA256 588ec98c6d760ed083b93d5e055c43080361034ac0a66ffa824f7aa8df735828
MD5 ecc5ee7200887e6208935e51f9b0ff54
BLAKE2b-256 9f2939a7e8543caf8bd9d92e42ee33c5033e395d514780509b9bd22f41b3e771

See more details on using hashes here.

Supported by

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