Skip to content

Commit

Permalink
More fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
wRAR committed Aug 20, 2024
1 parent 4ab9691 commit 9289399
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scrapy_zyte_api/providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ async def __call__( # noqa: C901
result = cls_stripped.from_dict(api_response.raw_api_response[kw]) # type: ignore[attr-defined]
custom_attrs = api_response.raw_api_response.get("customAttributes")

Check warning on line 330 in scrapy_zyte_api/providers.py

View check run for this annotation

Codecov / codecov/patch

scrapy_zyte_api/providers.py#L330

Added line #L330 was not covered by tests
if custom_attrs:
result.customAttributes = custom_attrs
result.customAttributes = custom_attrs # type: ignore[attr-defined]

Check warning on line 332 in scrapy_zyte_api/providers.py

View check run for this annotation

Codecov / codecov/patch

scrapy_zyte_api/providers.py#L332

Added line #L332 was not covered by tests
if is_typing_annotated(cls):
result = AnnotatedInstance(result, cls.__metadata__) # type: ignore[attr-defined]
results.append(result)
Expand Down
4 changes: 4 additions & 0 deletions tests/test_providers.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,6 +1240,10 @@ def currency(self):
def currencyRaw(self):
return self.product.currencyRaw

@field
def customAttributes(self):
return self.product.customAttributes

@field
def description(self):
return self.product.description
Expand Down
2 changes: 1 addition & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ deps =
andi==0.6.0
scrapy-poet==0.22.3
web-poet==0.17.0
zyte-common-items==0.20.0
zyte-common-items @ git+https://github.com/zytedata/zyte-common-items.git@custom-attrs

[testenv:pinned-extra]
basepython=python3.8
Expand Down

0 comments on commit 9289399

Please sign in to comment.