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

Uploaded Source

Built Distribution

pytest_anything-0.1.4-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pytest-anything-0.1.4.tar.gz
  • Upload date:
  • Size: 3.5 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.4.tar.gz
Algorithm Hash digest
SHA256 bf962202c02bc25dda527654ecb0c4fe938c76a09b8e28a860a38ca09bb8f6fa
MD5 d7b2565d28c8578277af754922d3a469
BLAKE2b-256 0242d0e1b46582a25ac203e05e2dd203ec9d1af42fa917905113f3a6e26146c5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pytest_anything-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 3.4 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 357f86d5655bc300ef3d816a8549ab31e01420b07bdf16142753284329f4870f
MD5 573b246a67da440c785acbe25c734f98
BLAKE2b-256 06c8d54541d5a3ec93634ad625a19b67e072ccff6fd5eee5a14ce17f5a3d85b0

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