Skip to main content

Hypothesis strategies for GraphQL schemas and queries

Project description

Build codecov.io status for master branch Version Python versions Gitter 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.3.tar.gz (8.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hypothesis_graphql-0.3.3-py3-none-any.whl (8.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hypothesis-graphql-0.3.3.tar.gz
  • Upload date:
  • Size: 8.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1036-azure

File hashes

Hashes for hypothesis-graphql-0.3.3.tar.gz
Algorithm Hash digest
SHA256 cebe2d1e2494a7e9c997a82373041a918e6023a8c63ee3363f828821796f8752
MD5 7d5f20fa469996a08b0493d868354690
BLAKE2b-256 533be0096237296fe26070fc70f8833e36260218e989167b7fcdc105653064bc

See more details on using hashes here.

File details

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

File metadata

  • Download URL: hypothesis_graphql-0.3.3-py3-none-any.whl
  • Upload date:
  • Size: 8.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.7 Linux/5.4.0-1036-azure

File hashes

Hashes for hypothesis_graphql-0.3.3-py3-none-any.whl
Algorithm Hash digest
SHA256 11e22c156dcf05f27df02c0c62d677457d11b12a091fd08c493d1326040754b0
MD5 5f89bc1474637c027cfea9b2fcdeb0ad
BLAKE2b-256 d3584b19998048a1c1dab56411da0e6be6b80312de1bc817e2694159cee74955

See more details on using hashes here.

Supported by

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