Skip to main content

Hypothesis strategies for GraphQL schemas and queries

Project description

Build codecov.io status for master branch Version Python versions License

Hypothesis strategies for GraphQL schemas, queries and data.

NOTE This package is experimental, some features are not supported yet.

Usage

There are two strategies for different use cases.

  1. Schema generation - hypothesis_graphql.strategies.schema()

  2. Query - hypothesis_graphql.strategies.query(schema).

Lets take this schema as an example:

type Book {
  title: String
  author: Author
}

type Author {
  name: String
  books: [Book]
}

type Query {
  getBooks: [Book]
  getAuthors: [Author]
}

Then strategies might be used in this way:

from hypothesis import given
from hypothesis_graphql import strategies as gql_st

SCHEMA = "..."  # the one above

@given(query=gql_st.query(SCHEMA))
def test_query(query):
    ...
    # This query might be generated:
    #
    # query {
    #   getBooks {
    #     title
    #   }
    # }

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

hypothesis-graphql-0.3.1.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

hypothesis_graphql-0.3.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file hypothesis-graphql-0.3.1.tar.gz.

File metadata

  • Download URL: hypothesis-graphql-0.3.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.0.5 CPython/3.8.3 Linux/5.3.0-1022-azure

File hashes

Hashes for hypothesis-graphql-0.3.1.tar.gz
Algorithm Hash digest
SHA256 0403b735c9b7a4800f05fe23b0af5ba0e480acee465b747845f6ec222e2e081b
MD5 b58eed18954caa06e65e6c1414aaddf8
BLAKE2b-256 19c28d2592f2630ba33f05f61d7c227eedd541588d1262b0cfa2e0e16afa7318

See more details on using hashes here.

File details

Details for the file hypothesis_graphql-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for hypothesis_graphql-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2d0a1ae799ed97a3fd366f9ee6fb47540858850c3e2d6f288117e85b746039d4
MD5 cf3db3de3ebb7ce9d7def4b6967bbca8
BLAKE2b-256 c17f58a73a562ec3f53d55683a6404ec84dd8711619f34aa89931a4c94efa159

See more details on using hashes here.

Supported by

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