{"library":"pytest-schema","title":"pytest-schema","description":"A pytest plugin that allows you to validate return values against a schema-like object, built on top of the `schema` library. Current version 0.1.2, released June 2024. Low release cadence.","language":"python","status":"active","last_verified":"Mon Apr 27","install":{"commands":["pip install pytest-schema"],"cli":null},"imports":["from pytest_schema import schema","from pytest_schema import like_schema","from pytest_schema import exact_schema"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pytest_schema import schema\n\ndef test_validate_schema():\n    expected = {\"name\": str, \"age\": int}\n    actual = {\"name\": \"Alice\", \"age\": 30}\n    assert actual == schema(expected)\n\ndef test_like_schema():\n    from pytest_schema import like_schema\n    expected = {\"id\": int, \"value\": str}\n    actual = {\"id\": 1, \"value\": \"foo\", \"extra\": True}\n    assert actual == like_schema(expected)\n\ndef test_exact_schema():\n    from pytest_schema import exact_schema\n    expected = {\"key\": str}\n    actual = {\"key\": \"val\"}\n    assert actual == exact_schema(expected)","lang":"python","description":"Basic usage of schema, like_schema, and exact_schema in pytest tests.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}