Skip to main content

Hypothesis strategy to generate JSON-RPC 2.0

Project description

hypothesis-jsonrpc

This Python package provides a Hypothesis strategy to generate Python objects compliant to the JSON-RPC 2.0 Specification to uncover unhandled edge cases in your code.

Example

>>> from pprint import pprint
>>> from hypothesis_jsonrpc.strategies import requests
>>> pprint(requests().example())
{'id': 29028,
 'jsonrpc': '2.0',
 'method': "\U000db1d5\U0004cabb'\x03",
 'params': {'-105.0': {},
            'Infinity': ['false', -1677172375.0, -inf],
            'nan': [19940.0]}}

Installation

The package is published to the Python Package Index (PyPI) and may be installed using your favorite installer, e.g.:

pip install hypothesis-jsonrpc

Remarks

  • So far, only requests, not responses, can be generated
  • Invalid requests are generated by mutating valid requests and are guranteed to be JSON compliant
  • Generated numbers are guaranteed to be processable as double-precision floating-point numbers
  • The non-standard constants supported by Python's json module may also be generated, but are disabled by default

Status & Versioning

Although this is a very young project, it was developed with a strong focus on quality and should be suitable for use in production environments. Versioning of releases will strictly follow the Semantic Versioning Specification (SemVer).

Licensing

This project may be licensed under the terms of the OSI approved MirOS License.

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 hypothesis-jsonrpc, version 2.0.0
Filename, size File type Python version Upload date Hashes
Filename, size hypothesis_jsonrpc-2.0.0-py3-none-any.whl (8.5 kB) File type Wheel Python version py3 Upload date Hashes View

Supported by

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