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.0

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.0
File Size Uploaded Provenance Actions
hs_dbus_signature-0.8.0.tar.gz 5.8 kB Without provenance Details for hs_dbus_signature-0.8.0.tar.gz

Built distribution (wheel)

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

Total release size: 11.0 kB

Release files / hs_dbus_signature-0.8.0.tar.gz

Download URL hs_dbus_signature-0.8.0.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4130908282fbcf9b9e9140896861f8bd7b21b6d46bae6eed807b3f5efa396b3e
BLAKE2b-256 checksum
How to use checksums
622223c8805bd8d79f855ace0343c3856262871f51d26100f24fdfb551db3284
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.0-py3-none-any.whl

Download URL hs_dbus_signature-0.8.0-py3-none-any.whl
Size 5.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
918eea44640d98d2b089b33aea91b54688e5f1403d2ff30d844509d18d7319c2
BLAKE2b-256 checksum
How to use checksums
acb569c7864d629842ec6c7147fc835d984f0a6030387f2943a64cc196634f76
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.0

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