Skip to main content

A Hypothesis Strategy for Generating Arbitrary DBus Signatures

This package contains a Hypothesis strategy for generating DBus signatures. An informal specification of DBus signatures is available at: https://dbus.freedesktop.org/doc/dbus-specification.html.

The strategy is intended to be both sound and complete. That is, it should never generate an invalid DBus signature and it should be capable, modulo size constraints, of generating any valid DBus signature.

Usage

Import the function and obtain a strategy with the default parameters.

>>> from hs_dbus_signature import dbus_signatures
>>> strategy = dbus_signatures()

Obtain a few examples of valid signatures, e.g.,

>>> strategy.example()
''
>>> strategy.example()
'a{ng}'
>>> strategy.example()
'a{xas}a{gah}a{nau}'

Make use of the strategy in your tests, e.g.

from hypothesis import given

@given(dbus_signatures())
def test(signature):
    ...

Use the parameters to omit dicts

>>> strategy = dbus_signatures(exclude_dicts=True)
>>> strategy.example()
'(gnggg)(n)(gn)(nnnnn)(nn)'

or to ensure that no example signature is the empty string

>>> strategy = dbus_signatures(min_complete_types=1)
>>> strategy.example()
'a{sv}'

The strategy will raise an InvalidArgument exception immediately if it is given arguments which allow no examples to be drawn.

>>> strategy = dbus_signatures(blacklist=string.ascii_lowercase)
Traceback (most recent call last):
...

Remarks

Documentation for the Hypothesis testing library can be found at http://hypothesis.readthedocs.io.

This strategy makes use of the Hypothesis higher-order strategy, recursive(), which is discussed here: http://hypothesis.works/articles/recursive-data/.

It is only supported for Python 3 as it uses Python 3 only syntax.

Downstream packagers, if incorporating testing into their packaging, are encouraged to use only the tests in the test_deterministic.py module, to avoid testing failures that may arise due to the non-deterministic behavior of Hypothesis tests.

Metadata

Release files for hs-dbus-signature 0.8.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hs-dbus-signature 0.8.1
File Size Uploaded Provenance Actions
hs_dbus_signature-0.8.1.tar.gz 5.8 kB Without provenance Details for hs_dbus_signature-0.8.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hs-dbus-signature 0.8.1
File Interpreter ABI Platform Actions
hs_dbus_signature-0.8.1-py3-none-any.whl Python 3 none any Details for hs_dbus_signature-0.8.1-py3-none-any.whl

Total release size: 11.0 kB

Release files / hs_dbus_signature-0.8.1.tar.gz

Download URL hs_dbus_signature-0.8.1.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
89209250dba2a01e2fdf1f6c42bfad3ca659686ee91da1bd86ca6e80ecc89859
BLAKE2b-256 checksum
How to use checksums
fe53b510c437bbf4998fb816ebabec1b9b5c6130d344d77fab486b6d4188fc75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Release files / hs_dbus_signature-0.8.1-py3-none-any.whl

Download URL hs_dbus_signature-0.8.1-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4406493f87163a5c265ef2538c551f53833b66065dfe87e424fcebf7e58a8e30
BLAKE2b-256 checksum
How to use checksums
5e8fd4255efe2abf73c59e561086c7b9a6e1f2e51c5f49e2a1904e5e40fe6829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.7

Security for hs-dbus-signature 0.8.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page