hypothesis-csv
hypothesis-csv is an extension to the hypothesis framework. The goal of this framework is to offer a flexible tool
to perform generative-testing/property-based testing for software that accepts CSV files as an input.
Description
hypothesis-csv is designed with two main use cases in mind:
test software that accepts a wide spectrum of CSV formats and doesn’t make assumptions on the content (i.e. CSV parsers)
test software that accepts very specific CSV formats and makes assumption on the content, types and header fields.
It provides two strategies, data_rows and csv, to pursue this goal, both contained in the strategies module.
Please refer to their documentation and the examples for more details.
Examples
Generate arbitrary, non-empty CSV
from hypothesis_csv.strategies import csv
@given(csv=csv())
def test_my_csv_parse(csv):
parsed_csv=my_csv_parser(csv)
assert ...
Generate CSV of a given size (5 columns x 20 rows)
from hypothesis_csv.strategies import csv
@given(csv=csv(lines=20,header=5))
def test_my_csv_parse(csv):
parsed_csv=my_csv_parser(csv)
assert parsed_csv.num_columns == 5
assert parsed_csv.num_rows == 20
Generate CSV with a header
from hypothesis_csv.strategies import csv
@given(csv=csv(header=["timestamp","val_1","val_2"]))
def test_my_csv_parse(csv):
parsed_csv=my_csv_parser(csv)
assert parsed_csv.num_columns == 3
Generate CSV with columns of a given type
from hypothesis_csv.strategies import csv
@given(csv=csv(columns=[text(),int(),float()]))
def test_my_csv_parse(csv):
parsed_csv=my_csv_parser(csv)
assert parsed_csv.num_columns == 3
Generate CSV with a given dialect
from hypothesis_csv.strategies import csv
@given(csv=csv(columns=[text(),int(),float()], dialect="excel-tab"))
def test_my_csv_parse(csv):
...
Generate CSV with drawns dialects
from hypothesis_csv.strategies import csv
@given(csv=csv(columns=[text(),int(),float()], dialect=None))
def test_my_csv_parse(csv):
...
Metadata
Release files for hypothesis-csv 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| hypothesis-csv-0.3.4.tar.gz | 17.2 kB | Without provenance | Details for hypothesis-csv-0.3.4.tar.gz |
Release files / hypothesis-csv-0.3.4.tar.gz
| Download URL | hypothesis-csv-0.3.4.tar.gz |
|---|---|
| Size | 17.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8716d10a93a22edce2c78544624056b412bd6083bde9e5a1166a02be57d55e6e
|
|
BLAKE2b-256 checksum How to use checksums |
af4bb97ce73a2d0f638d8af8e11631bfd0aa6bfe3e4057b49f94a198f5e1216b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.32.1 CPython/3.6.7
|
Security for hypothesis-csv 0.3.4
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.