Skip to main content

qload : better assertion on files

qload is a library to load or extract content of a file to perform assertion in automatic tests without boilerplate. It support file from filesystem, ftp, s3, ...

Benefits

  • oneliner to assert on the content of a file
  • useful differential when the test fails thanks to subpart extraction
  • support for the most common formats (yaml, csv, json, txt)
  • support for multiple file systems and protocols (local, ftp, s3)
  • rich expression engine to extract part of a file (regexp for text and jmespath for csv, json and yaml to improve differential)

Gettings started

pip install qload

Usage

import qload

assert 'database_url: postgresql://127.0.0.1:5432/postgres' in qload.text('file.txt')
assert qload.text('file.txt', expression='Hello .*') == 'Hello Fabien'

assert qload.json('file.json') == {}
assert qload.json('s3://mybucket/file1.json') == {}
assert qload.json('file.json', expression='$.id') == ''
assert len(qload.json('file.json', expression='$.id')) == 4

assert qload.yaml('file.yml')  == {}
assert qload.yaml('file.yml', expression='$.id')  == ''

assert qload.csv('file.csv', expression='[*].Account') == ['ALK', 'BTL', 'CKL']
assert qload.csv('file.csv', expression='[*].Account')[0] == 'ALK'

assert qload.parquet('file.parquet', expression='[*].Account')[0] == 'ALK'

assert qload.ftp(host='localhost', port=21, login='admin', password='admin').csv(path='dir/file.csv', expression='') == []
assert qload.s3(bucket='bucket', aws_access_key_id='', aws_secret_access_key='', region_name='eu-west-1', endpoint_url='http://localhost:9090').json(path='dir/file.csv') == {}


assert qload.isfile('file.json') is True
assert qload.s3(bucket='bucket').isfile('file.json') is True

Metadata

Release files for qload 1.0.3

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

Source distribution (sdist)

Source distribution for qload 1.0.3
File Size Uploaded
qload-1.0.3.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for qload 1.0.3
File Interpreter ABI Platform
qload-1.0.3-py3-none-any.whl Python 3 none any Details

Total release size: 11.9 kB

Release files / qload-1.0.3.tar.gz

Download URL qload-1.0.3.tar.gz
Size 5.3 kB
Tags Source
SHA-256 checksum
How to use checksums
415bde98c37d47c756ba07aaeb45f148de0fb22ccf1b1367a2ed8d94373049eb
BLAKE2b-256 checksum
How to use checksums
d1d199d58ce87873ac39400f39f50d4846a69cdfa2634cc47c3ba4344b66a263
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-35-generic

Release files / qload-1.0.3-py3-none-any.whl

Download URL qload-1.0.3-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
af38eafd0ec0bfbf439f5d2a6db057f2255d339313afa9aef8517faf10d6188f
BLAKE2b-256 checksum
How to use checksums
afbf27c829349cd42b389a4e5051c3d89348d509d8ac989be79cb2e3124f23d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.8.2 CPython/3.10.12 Linux/6.5.0-35-generic

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

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