Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle custom attributes received in the API response. #213

Merged
merged 13 commits into from
Sep 19, 2024
Merged

Conversation

wRAR
Copy link
Contributor

@wRAR wRAR commented Aug 19, 2024

No description provided.

@wRAR
Copy link
Contributor Author

wRAR commented Aug 19, 2024

Requires zytedata/zyte-common-items#100

Copy link

codecov bot commented Aug 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 97.86%. Comparing base (c1ba9c0) to head (b7e22e7).
Report is 14 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #213      +/-   ##
==========================================
+ Coverage   97.69%   97.86%   +0.16%     
==========================================
  Files          14       14              
  Lines        1564     1590      +26     
  Branches      330      337       +7     
==========================================
+ Hits         1528     1556      +28     
+ Misses         15       14       -1     
+ Partials       21       20       -1     
Files with missing lines Coverage Δ
scrapy_zyte_api/__init__.py 100.00% <100.00%> (ø)
scrapy_zyte_api/_annotations.py 100.00% <100.00%> (+4.16%) ⬆️
scrapy_zyte_api/providers.py 94.65% <100.00%> (+0.50%) ⬆️

@wRAR
Copy link
Contributor Author

wRAR commented Aug 19, 2024

(some test failures related to field overrides)

@Gallaecio
Copy link
Contributor

I’ll handle the update of

_REQUEST_PARAMS: Dict[str, Dict[str, Any]] = {
since I am already refactoring it significantly as part of SERP work.

@wRAR wRAR marked this pull request as draft September 12, 2024 08:04
@wRAR wRAR marked this pull request as ready for review September 17, 2024 10:52
Comment on lines 196 to 200
k: (
dict(v)
if isinstance(v, frozenset)
else list(v) if isinstance(v, tuple) else v
)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this code seems to be copy-pasted - time to add a helper function? Is it something like undo_make_hashable?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done, and now I think both functions need tests. We don't actually test what we receive in mockserver requests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, let's add a few tests!

@wRAR wRAR closed this Sep 18, 2024
@wRAR wRAR reopened this Sep 18, 2024
Copy link
Member

@kmike kmike left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The code looks good. +1 to merge after CI is fixed, and some very basic tests are added for the hash/unhash functions.

@wRAR
Copy link
Contributor Author

wRAR commented Sep 19, 2024

We should release zyte-common-items before merging this I think.

@kmike
Copy link
Member

kmike commented Sep 19, 2024

@wRAR feel free to merge when you think it's ready.

@wRAR wRAR merged commit 47d3e1f into main Sep 19, 2024
19 checks passed
@wRAR wRAR deleted the custom-attrs branch September 19, 2024 17:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants