diff options
| author | CoprDistGit <infra@openeuler.org> | 2023-05-18 04:59:42 +0000 |
|---|---|---|
| committer | CoprDistGit <infra@openeuler.org> | 2023-05-18 04:59:42 +0000 |
| commit | cc233f0d176b451a557a9ddd59ebf3f0f2121ca5 (patch) | |
| tree | 5faf7196dd17ddcd7c11c0b583806965661261af /python-pytest-dictsdiff.spec | |
| parent | a4371f1775d9d0545dcc30221482db9e6fe4964b (diff) | |
automatic import of python-pytest-dictsdiff
Diffstat (limited to 'python-pytest-dictsdiff.spec')
| -rw-r--r-- | python-pytest-dictsdiff.spec | 553 |
1 files changed, 553 insertions, 0 deletions
diff --git a/python-pytest-dictsdiff.spec b/python-pytest-dictsdiff.spec new file mode 100644 index 0000000..6af775e --- /dev/null +++ b/python-pytest-dictsdiff.spec @@ -0,0 +1,553 @@ +%global _empty_manifest_terminate_build 0 +Name: python-pytest-dictsdiff +Version: 0.5.8 +Release: 1 +Summary: please add a summary manually as the author left a blank one +License: MIT +URL: https://pypi.org/project/pytest-dictsdiff/ +Source0: https://mirrors.nju.edu.cn/pypi/web/packages/c0/0c/09d1386308ad7edc2993a8aee8981a76603058c756db50d16cb4cdfe45e4/pytest-dictsdiff-0.5.8.tar.gz +BuildArch: noarch + +Requires: python3-dictdiffer + +%description +# pytest-dictsdiff + + +## Installation + + $ pip install pytest-dictsdiff + +## Usage + + +At your test use `dicts_are_same` fixture and use it to compare two +objects: + +```python + +def test_dicts(dicts_are_same): + dict1 = {'a': 1, 'b': 2, 'c': {'d': 4, 'e': 5}} + dict2 = {'a': 100, 'f': 2, 'c': {'d': 400, 'g': 5}} + assert dicts_are_same(dict1, dict2) +``` + +Or compare objects using direct function call: + +```python +from pytest_dictsdiff import check_objects + + +def test_dicts(): + dict1 = {'a': 1, 'b': 2, 'c': {'d': 4, 'e': 5}} + dict2 = {'a': 100, 'f': 2, 'c': {'d': 400, 'g': 5}} + assert check_objects(dict1, dict2) +``` + +## Todos + +- [ ] Use `pprint` instead of `json` when showing objects (currently it would fail + if data would contain any non-json-serializable objects) + + +## Example + +Save following snippet as `dicts.py` and run `pytest dicts.py`. + +```python +from collections import OrderedDict + + +RESULT = OrderedDict({ + "cell": "(056)-022-8631", + "dob": { + "age": 44, + "date": "1983-11-04T01:21:14Z" + }, + "email": "zeyneb.elfring@example.com", + "gender": "female", + "id": { + "name": "BSN", + "value": "36180866" + }, + "location": { + "city": "tholen", + "coordinates": { + "latitude": "46.8823", + "longitude": "175.8856" + }, + "postcode": 64504, + "state": "groningen", + "street": "2074 adriaen van ostadelaan", + "timezone": { + "description": "Adelaide, Darwin", + "offset": "+9:30" + } + }, + "login": { + "md5": "bafe8cf9d37806a7b13edc218d5ff762", + "password": "ontario", + "salt": "QVBKgEjy", + "sha1": "cacef09ff61072d1c55732963766fa84e919aa7a", + "sha256": "cc86af47aedbdbb1de73ff10484996fe9785c47c0fc191b7c67eaf71e0782300", + "username": "smallgorilla897", + "uuid": "37e30c59-bc79-4172-aac6-e2c640e165fa" + }, + "name": { + "first": "zeyneb", + "last": "elfring", + "title": "mrs" + }, + "nat": "NL", + "phone": "(209)-143-9697", + "picture": { + "large": "https://randomuser.me/api/portraits/women/37.jpg", + "medium": "https://randomuser.me/api/portraits/med/women/37.jpg", + "thumbnail": "https://randomuser.me/api/portraits/thumb/women/37.jpg" + }, + "registered": { + "age": 3, + "date": "2014-12-07T06:54:14Z" + } +}) + +EXPECTED_DATA = { + "cell": "(056)-022-8631", + "dob": { + "age": 34, + "date": "1953-11-04T01:21:04Z" + }, + "email": "zeyneb.elfring@example.com", + "gender": "female", + "id": { + "name": "BSN", + "value": "36180866" + }, + "location": { + "city": "Tholen", + "coordinates": { + "latitude": "46.8823", + "longitude": "175.8856" + }, + "postcode": 64509, + "state": "groningen", + "street": "2074 adriaen van ostadelaan", + "timezone": { + "description": "Adelaide, Darwin", + "offset": "+9:30" + } + }, + "login": { + "md5": "bafe8cf9d37806a7b13edc218d5ff762", + "password": "ontario", + "salt": "QVBKgEjy", + "sha1": "cacef09ff61072d1c55732963766fa84e919aa7a", + "sha256": "cc86af47aedbdbb1de73ff10484996fe9785c47c0fc191b7c67eaf71e0782300", + "username": "smallgorilla897", + "uuid": "37e30c59-bc79-4172-aac6-e2c640e165fa" + }, + "name": { + "first": "Zeyneb", + "last": "Elfring", + "title": "mrs" + }, + "nat": "NL", + "phone": "(209)-143-9697", + "picture": { + "large": "https://randomuser.me/api/portraits/women/37.jpg", + "medium": "https://randomuser.me/api/portraits/med/women/37.jpg", + "thumbnail": "https://randomuser.me/api/portraits/thumb/women/37.jpg" + }, + "registered": { + "age": 3, + "date": "2014-12-07T06:54:14Z" + } +} + + +def test_compare_dicts(dicts_are_same): + assert dicts_are_same(RESULT, EXPECTED_DATA) + +``` + + + + +%package -n python3-pytest-dictsdiff +Summary: please add a summary manually as the author left a blank one +Provides: python-pytest-dictsdiff +BuildRequires: python3-devel +BuildRequires: python3-setuptools +BuildRequires: python3-pip +%description -n python3-pytest-dictsdiff +# pytest-dictsdiff + + +## Installation + + $ pip install pytest-dictsdiff + +## Usage + + +At your test use `dicts_are_same` fixture and use it to compare two +objects: + +```python + +def test_dicts(dicts_are_same): + dict1 = {'a': 1, 'b': 2, 'c': {'d': 4, 'e': 5}} + dict2 = {'a': 100, 'f': 2, 'c': {'d': 400, 'g': 5}} + assert dicts_are_same(dict1, dict2) +``` + +Or compare objects using direct function call: + +```python +from pytest_dictsdiff import check_objects + + +def test_dicts(): + dict1 = {'a': 1, 'b': 2, 'c': {'d': 4, 'e': 5}} + dict2 = {'a': 100, 'f': 2, 'c': {'d': 400, 'g': 5}} + assert check_objects(dict1, dict2) +``` + +## Todos + +- [ ] Use `pprint` instead of `json` when showing objects (currently it would fail + if data would contain any non-json-serializable objects) + + +## Example + +Save following snippet as `dicts.py` and run `pytest dicts.py`. + +```python +from collections import OrderedDict + + +RESULT = OrderedDict({ + "cell": "(056)-022-8631", + "dob": { + "age": 44, + "date": "1983-11-04T01:21:14Z" + }, + "email": "zeyneb.elfring@example.com", + "gender": "female", + "id": { + "name": "BSN", + "value": "36180866" + }, + "location": { + "city": "tholen", + "coordinates": { + "latitude": "46.8823", + "longitude": "175.8856" + }, + "postcode": 64504, + "state": "groningen", + "street": "2074 adriaen van ostadelaan", + "timezone": { + "description": "Adelaide, Darwin", + "offset": "+9:30" + } + }, + "login": { + "md5": "bafe8cf9d37806a7b13edc218d5ff762", + "password": "ontario", + "salt": "QVBKgEjy", + "sha1": "cacef09ff61072d1c55732963766fa84e919aa7a", + "sha256": "cc86af47aedbdbb1de73ff10484996fe9785c47c0fc191b7c67eaf71e0782300", + "username": "smallgorilla897", + "uuid": "37e30c59-bc79-4172-aac6-e2c640e165fa" + }, + "name": { + "first": "zeyneb", + "last": "elfring", + "title": "mrs" + }, + "nat": "NL", + "phone": "(209)-143-9697", + "picture": { + "large": "https://randomuser.me/api/portraits/women/37.jpg", + "medium": "https://randomuser.me/api/portraits/med/women/37.jpg", + "thumbnail": "https://randomuser.me/api/portraits/thumb/women/37.jpg" + }, + "registered": { + "age": 3, + "date": "2014-12-07T06:54:14Z" + } +}) + +EXPECTED_DATA = { + "cell": "(056)-022-8631", + "dob": { + "age": 34, + "date": "1953-11-04T01:21:04Z" + }, + "email": "zeyneb.elfring@example.com", + "gender": "female", + "id": { + "name": "BSN", + "value": "36180866" + }, + "location": { + "city": "Tholen", + "coordinates": { + "latitude": "46.8823", + "longitude": "175.8856" + }, + "postcode": 64509, + "state": "groningen", + "street": "2074 adriaen van ostadelaan", + "timezone": { + "description": "Adelaide, Darwin", + "offset": "+9:30" + } + }, + "login": { + "md5": "bafe8cf9d37806a7b13edc218d5ff762", + "password": "ontario", + "salt": "QVBKgEjy", + "sha1": "cacef09ff61072d1c55732963766fa84e919aa7a", + "sha256": "cc86af47aedbdbb1de73ff10484996fe9785c47c0fc191b7c67eaf71e0782300", + "username": "smallgorilla897", + "uuid": "37e30c59-bc79-4172-aac6-e2c640e165fa" + }, + "name": { + "first": "Zeyneb", + "last": "Elfring", + "title": "mrs" + }, + "nat": "NL", + "phone": "(209)-143-9697", + "picture": { + "large": "https://randomuser.me/api/portraits/women/37.jpg", + "medium": "https://randomuser.me/api/portraits/med/women/37.jpg", + "thumbnail": "https://randomuser.me/api/portraits/thumb/women/37.jpg" + }, + "registered": { + "age": 3, + "date": "2014-12-07T06:54:14Z" + } +} + + +def test_compare_dicts(dicts_are_same): + assert dicts_are_same(RESULT, EXPECTED_DATA) + +``` + + + + +%package help +Summary: Development documents and examples for pytest-dictsdiff +Provides: python3-pytest-dictsdiff-doc +%description help +# pytest-dictsdiff + + +## Installation + + $ pip install pytest-dictsdiff + +## Usage + + +At your test use `dicts_are_same` fixture and use it to compare two +objects: + +```python + +def test_dicts(dicts_are_same): + dict1 = {'a': 1, 'b': 2, 'c': {'d': 4, 'e': 5}} + dict2 = {'a': 100, 'f': 2, 'c': {'d': 400, 'g': 5}} + assert dicts_are_same(dict1, dict2) +``` + +Or compare objects using direct function call: + +```python +from pytest_dictsdiff import check_objects + + +def test_dicts(): + dict1 = {'a': 1, 'b': 2, 'c': {'d': 4, 'e': 5}} + dict2 = {'a': 100, 'f': 2, 'c': {'d': 400, 'g': 5}} + assert check_objects(dict1, dict2) +``` + +## Todos + +- [ ] Use `pprint` instead of `json` when showing objects (currently it would fail + if data would contain any non-json-serializable objects) + + +## Example + +Save following snippet as `dicts.py` and run `pytest dicts.py`. + +```python +from collections import OrderedDict + + +RESULT = OrderedDict({ + "cell": "(056)-022-8631", + "dob": { + "age": 44, + "date": "1983-11-04T01:21:14Z" + }, + "email": "zeyneb.elfring@example.com", + "gender": "female", + "id": { + "name": "BSN", + "value": "36180866" + }, + "location": { + "city": "tholen", + "coordinates": { + "latitude": "46.8823", + "longitude": "175.8856" + }, + "postcode": 64504, + "state": "groningen", + "street": "2074 adriaen van ostadelaan", + "timezone": { + "description": "Adelaide, Darwin", + "offset": "+9:30" + } + }, + "login": { + "md5": "bafe8cf9d37806a7b13edc218d5ff762", + "password": "ontario", + "salt": "QVBKgEjy", + "sha1": "cacef09ff61072d1c55732963766fa84e919aa7a", + "sha256": "cc86af47aedbdbb1de73ff10484996fe9785c47c0fc191b7c67eaf71e0782300", + "username": "smallgorilla897", + "uuid": "37e30c59-bc79-4172-aac6-e2c640e165fa" + }, + "name": { + "first": "zeyneb", + "last": "elfring", + "title": "mrs" + }, + "nat": "NL", + "phone": "(209)-143-9697", + "picture": { + "large": "https://randomuser.me/api/portraits/women/37.jpg", + "medium": "https://randomuser.me/api/portraits/med/women/37.jpg", + "thumbnail": "https://randomuser.me/api/portraits/thumb/women/37.jpg" + }, + "registered": { + "age": 3, + "date": "2014-12-07T06:54:14Z" + } +}) + +EXPECTED_DATA = { + "cell": "(056)-022-8631", + "dob": { + "age": 34, + "date": "1953-11-04T01:21:04Z" + }, + "email": "zeyneb.elfring@example.com", + "gender": "female", + "id": { + "name": "BSN", + "value": "36180866" + }, + "location": { + "city": "Tholen", + "coordinates": { + "latitude": "46.8823", + "longitude": "175.8856" + }, + "postcode": 64509, + "state": "groningen", + "street": "2074 adriaen van ostadelaan", + "timezone": { + "description": "Adelaide, Darwin", + "offset": "+9:30" + } + }, + "login": { + "md5": "bafe8cf9d37806a7b13edc218d5ff762", + "password": "ontario", + "salt": "QVBKgEjy", + "sha1": "cacef09ff61072d1c55732963766fa84e919aa7a", + "sha256": "cc86af47aedbdbb1de73ff10484996fe9785c47c0fc191b7c67eaf71e0782300", + "username": "smallgorilla897", + "uuid": "37e30c59-bc79-4172-aac6-e2c640e165fa" + }, + "name": { + "first": "Zeyneb", + "last": "Elfring", + "title": "mrs" + }, + "nat": "NL", + "phone": "(209)-143-9697", + "picture": { + "large": "https://randomuser.me/api/portraits/women/37.jpg", + "medium": "https://randomuser.me/api/portraits/med/women/37.jpg", + "thumbnail": "https://randomuser.me/api/portraits/thumb/women/37.jpg" + }, + "registered": { + "age": 3, + "date": "2014-12-07T06:54:14Z" + } +} + + +def test_compare_dicts(dicts_are_same): + assert dicts_are_same(RESULT, EXPECTED_DATA) + +``` + + + + +%prep +%autosetup -n pytest-dictsdiff-0.5.8 + +%build +%py3_build + +%install +%py3_install +install -d -m755 %{buildroot}/%{_pkgdocdir} +if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi +if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi +if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi +if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi +pushd %{buildroot} +if [ -d usr/lib ]; then + find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/lib64 ]; then + find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/bin ]; then + find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst +fi +if [ -d usr/sbin ]; then + find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst +fi +touch doclist.lst +if [ -d usr/share/man ]; then + find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst +fi +popd +mv %{buildroot}/filelist.lst . +mv %{buildroot}/doclist.lst . + +%files -n python3-pytest-dictsdiff -f filelist.lst +%dir %{python3_sitelib}/* + +%files help -f doclist.lst +%{_docdir}/* + +%changelog +* Thu May 18 2023 Python_Bot <Python_Bot@openeuler.org> - 0.5.8-1 +- Package Spec generated |
