qload


Nameqload JSON
Version 1.0.1 PyPI version JSON
download
home_page
Summarypython library to perform assertion on files
upload_time2023-05-09 12:20:40
maintainer
docs_urlNone
authorFabien Arcellier
requires_python>=3.8,<4.0
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": "",
    "name": "qload",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Fabien Arcellier",
    "author_email": "fabien.arcellier@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/ca/75/6bf35df97ce4a118bfb94cc60c408d26b090ae9eef73ab883979108f90df/qload-1.0.1.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.1",
    "project_urls": {
        "Source": "https://github.com/FabienArcellier/qload"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0eefe2039d668b75ab8b04ca9ebe56525fcb117beb5786979d4b1c969974f2cb",
                "md5": "df021232d38dd7fe171d626e8d321420",
                "sha256": "0674e19b0ebd3cf2e00be07070c3dd430ccfb3a0786db4a55c430b7ffb7f6556"
            },
            "downloads": -1,
            "filename": "qload-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "df021232d38dd7fe171d626e8d321420",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 6586,
            "upload_time": "2023-05-09T12:20:38",
            "upload_time_iso_8601": "2023-05-09T12:20:38.202875Z",
            "url": "https://files.pythonhosted.org/packages/0e/ef/e2039d668b75ab8b04ca9ebe56525fcb117beb5786979d4b1c969974f2cb/qload-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ca756bf35df97ce4a118bfb94cc60c408d26b090ae9eef73ab883979108f90df",
                "md5": "41822dbb0b1ed9d0e8e042a9a28489af",
                "sha256": "8b322547a38daf478d4ba04138b15c77d2e0e267162e14603d68d0dfec9bc2ba"
            },
            "downloads": -1,
            "filename": "qload-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "41822dbb0b1ed9d0e8e042a9a28489af",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 5795,
            "upload_time": "2023-05-09T12:20:40",
            "upload_time_iso_8601": "2023-05-09T12:20:40.368978Z",
            "url": "https://files.pythonhosted.org/packages/ca/75/6bf35df97ce4a118bfb94cc60c408d26b090ae9eef73ab883979108f90df/qload-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-05-09 12:20:40",
    "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: 0.05994s