Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

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, None, object()])
def test_anything(obj, Anything):
    assert obj == Anything


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


def test_nothing(Something):
    obj = None
    assert obj != Something


def test_anything_repr(Anything):
    assert repr(Anything) == "Anything"


def test_something_repr(Something):
    assert repr(Something) == "Something"

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for pytest-anything, version 0.1.2
Filename, size File type Python version Upload date Hashes
Filename, size pytest_anything-0.1.2-py3-none-any.whl (2.2 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size pytest-anything-0.1.2.tar.gz (2.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page