Skip to main content

Pytest fixtures to assert anything and something

Project description

If you ever had to ignore a certain part of an assertion, you would end up with this.

import pytest


@pytest.mark.parametrize(
    "obj",
    [
        "string",
        123,
        123.1,
        True,
        False,
        [],
        {},
        (),
        object,
        object(),
        type,
        type(None),
        None,
    ],
)
def test_anything(obj, Anything):
    assert obj == Anything


@pytest.mark.parametrize(
    "obj",
    [
        "string",
        123,
        123.1,
        True,
        False,
        [],
        {},
        (),
        object,
        object(),
        type,
        type(None),
    ],
)
def test_something(obj, Something):
    assert obj == Something


def test_nothing(Something):
    assert None != Something


def test_something_special(Something):
    assert object() == Something(lambda x: isinstance(x, object))

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

pytest-anything-0.1.3.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

pytest_anything-0.1.3-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file pytest-anything-0.1.3.tar.gz.

File metadata

  • Download URL: pytest-anything-0.1.3.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for pytest-anything-0.1.3.tar.gz
Algorithm Hash digest
SHA256 e7927156e9048e257ef90f37eb893df2c2cd3c4c8af0e87ffc2a7c6cbeecc856
MD5 f9b1f905e2a5627b474bf024001b42bb
BLAKE2b-256 1ee4b56a7c94219a7237b43b9443ff2d6b6b84ecfd9e623b9a2926605e832277

See more details on using hashes here.

File details

Details for the file pytest_anything-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: pytest_anything-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 3.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.10.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.9

File hashes

Hashes for pytest_anything-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c48804934b9341bd73abd77059c99df459064e76202610105634c37355dd10a2
MD5 f1b75f8cd53952281f17e509c9d24f4f
BLAKE2b-256 64fa639f17e2a1d1086e298cd8761d36ff1b575578f5a7e53a9ac39bff361d1a

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