From 60796c756316560c8ca23eab319540511c463795 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexey=20ALERT=20Rubash=D1=91ff?= Date: Thu, 1 Aug 2024 16:23:08 +0300 Subject: [PATCH] ! readme --- README.md | 18 +++++++++++------- tests/test_suite.py | 38 +++++++++++++++++++------------------- 2 files changed, 30 insertions(+), 26 deletions(-) diff --git a/README.md b/README.md index 14b8b3c..92d0670 100644 --- a/README.md +++ b/README.md @@ -5,19 +5,23 @@ Rozetka.ua Python API --------------------- +[![PyPi Package](https://github.com/ALERTua/rozetka_api/actions/workflows/pypi.yml/badge.svg)](https://github.com/ALERTua/rozetka_api/actions/workflows/pypi.yml) +[![Docker Image Latest](https://github.com/ALERTua/rozetka_api/actions/workflows/docker-image.yml/badge.svg)](https://github.com/ALERTua/rozetka_api/actions/workflows/docker-image.yml) Hey-hey, Rozetka employee, I mean no harm. I just wanna know whether your discounts are real. Luvz. Do not forget to run with `--init` for SIGTERM to correctly forward to child processes. -### Examples - -rozetka/examples/example_item.py - -rozetka/examples/example_category.py - ### Github https://github.com/ALERTua/rozetka_api ### PyPi -https://pypi.org/project/rozetka-api/ +https://pypi.org/project/rozetka-api + +### Examples + +[examples/example_item.py](rozetka/examples/example_item.py) + +[examples/example_category.py](rozetka/examples/example_category.py) + +[tests/test_suite.py](tests/test_suite.py) diff --git a/tests/test_suite.py b/tests/test_suite.py index 09bd3f3..8ddd662 100644 --- a/tests/test_suite.py +++ b/tests/test_suite.py @@ -48,6 +48,25 @@ def test_item_getter(): assert item.title +def test_item_in_category(): + item = Item.get(ITEM_ID) + item.parse() + category = Category.get(item.category_id) + assert item.category_id == category.id_ + + category_items = category.items + category.parse_items() + + subitems_ids = list(set(list(chain(*[_.subitem_ids for _ in category_items])))) + subitems_ids.sort() + # assert item.id_ in category.items_ids or item.id_ in subitems_ids + + subitems = Item.parse_multiple(*subitems_ids, subitems=True) + items_and_subitems = category_items + subitems + items_and_subitems.sort(key=lambda _: _.id_) + assert item in items_and_subitems + + def test_subitems(): item = Item.get(ITEM_ID) item.parse() @@ -88,22 +107,3 @@ def test_point_hash(): list_ = [point, point2, point3] set_ = set(list_) assert len(set_) < len(list_), "Points should be unique" - - -def test_item_in_category(): - item = Item.get(ITEM_ID) - item.parse() - category = Category.get(item.category_id) - assert item.category_id == category.id_ - - category_items = category.items - category.parse_items() - - subitems_ids = list(set(list(chain(*[_.subitem_ids for _ in category_items])))) - subitems_ids.sort() - # assert item.id_ in category.items_ids or item.id_ in subitems_ids - - subitems = Item.parse_multiple(*subitems_ids, subitems=True) - items_and_subitems = category_items + subitems - items_and_subitems.sort(key=lambda _: _.id_) - assert item in items_and_subitems