Skip to content

Commit

Permalink
! readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ALERTua committed Aug 1, 2024
1 parent 353fa59 commit 60796c7
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 26 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
38 changes: 19 additions & 19 deletions tests/test_suite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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

0 comments on commit 60796c7

Please sign in to comment.