qload


Nameqload JSON
Version 1.0.3 PyPI version JSON
download
home_pageNone
Summarypython library to perform assertion on files
upload_time2024-06-05 03:22:45
maintainerNone
docs_urlNone
authorFabien Arcellier
requires_python<4.0,>=3.8
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 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](https://docs.python.org/3/library/re.html#regular-expression-syntax) for `text` and [jmespath](https://jmespath.org) for `csv`, `json` and `yaml` to improve differential) 

## Gettings started

```bash
pip install qload
```

## Usage

```python
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
```
            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "qload",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.8",
    "maintainer_email": null,
    "keywords": null,
    "author": "Fabien Arcellier",
    "author_email": "fabien.arcellier@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/d1/d1/99d58ce87873ac39400f39f50d4846a69cdfa2634cc47c3ba4344b66a263/qload-1.0.3.tar.gz",
    "platform": null,
    "description": "# qload : better assertion on files\n\nqload is a library to load or extract content of a file to perform assertion in automatic tests without\nboilerplate. It support file from filesystem, ftp, s3, ...\n\n## Benefits\n\n* oneliner to assert on the content of a file\n* useful differential when the test fails thanks to subpart extraction\n* support for the most common formats (yaml, csv, json, txt)\n* support for multiple file systems and protocols (local, ftp, s3)\n* rich expression engine to extract part of a file ([regexp](https://docs.python.org/3/library/re.html#regular-expression-syntax) for `text` and [jmespath](https://jmespath.org) for `csv`, `json` and `yaml` to improve differential) \n\n## Gettings started\n\n```bash\npip install qload\n```\n\n## Usage\n\n```python\nimport qload\n\nassert 'database_url: postgresql://127.0.0.1:5432/postgres' in qload.text('file.txt')\nassert qload.text('file.txt', expression='Hello .*') == 'Hello Fabien'\n\nassert qload.json('file.json') == {}\nassert qload.json('s3://mybucket/file1.json') == {}\nassert qload.json('file.json', expression='$.id') == ''\nassert len(qload.json('file.json', expression='$.id')) == 4\n\nassert qload.yaml('file.yml')  == {}\nassert qload.yaml('file.yml', expression='$.id')  == ''\n\nassert qload.csv('file.csv', expression='[*].Account') == ['ALK', 'BTL', 'CKL']\nassert qload.csv('file.csv', expression='[*].Account')[0] == 'ALK'\n\nassert qload.parquet('file.parquet', expression='[*].Account')[0] == 'ALK'\n\nassert qload.ftp(host='localhost', port=21, login='admin', password='admin').csv(path='dir/file.csv', expression='') == []\nassert 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') == {}\n\n\nassert qload.isfile('file.json') is True\nassert qload.s3(bucket='bucket').isfile('file.json') is True\n```",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "python library to perform assertion on files",
    "version": "1.0.3",
    "project_urls": {
        "Source": "https://github.com/FabienArcellier/qload"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "afbf27c829349cd42b389a4e5051c3d89348d509d8ac989be79cb2e3124f23d6",
                "md5": "f5b568e2230322d487ef2a097e5696fa",
                "sha256": "af38eafd0ec0bfbf439f5d2a6db057f2255d339313afa9aef8517faf10d6188f"
            },
            "downloads": -1,
            "filename": "qload-1.0.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f5b568e2230322d487ef2a097e5696fa",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.8",
            "size": 6587,
            "upload_time": "2024-06-05T03:22:44",
            "upload_time_iso_8601": "2024-06-05T03:22:44.141943Z",
            "url": "https://files.pythonhosted.org/packages/af/bf/27c829349cd42b389a4e5051c3d89348d509d8ac989be79cb2e3124f23d6/qload-1.0.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d1d199d58ce87873ac39400f39f50d4846a69cdfa2634cc47c3ba4344b66a263",
                "md5": "7d609f146094e1a8c0431e9bf3ec58d7",
                "sha256": "415bde98c37d47c756ba07aaeb45f148de0fb22ccf1b1367a2ed8d94373049eb"
            },
            "downloads": -1,
            "filename": "qload-1.0.3.tar.gz",
            "has_sig": false,
            "md5_digest": "7d609f146094e1a8c0431e9bf3ec58d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.8",
            "size": 5275,
            "upload_time": "2024-06-05T03:22:45",
            "upload_time_iso_8601": "2024-06-05T03:22:45.960264Z",
            "url": "https://files.pythonhosted.org/packages/d1/d1/99d58ce87873ac39400f39f50d4846a69cdfa2634cc47c3ba4344b66a263/qload-1.0.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-06-05 03:22:45",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "FabienArcellier",
    "github_project": "qload",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "qload"
}
        
Elapsed time: 1.04261s