forked from scrapinghub/web-poet
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request scrapinghub#171 from scrapinghub/testing-meta-adap…
…ters Support custom item adapters in fixtures
- Loading branch information
Showing
6 changed files
with
137 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from collections import deque | ||
from typing import Deque, Type | ||
|
||
from itemadapter import ItemAdapter | ||
from itemadapter.adapter import ( | ||
AdapterInterface, | ||
AttrsAdapter, | ||
DataclassAdapter, | ||
DictAdapter, | ||
PydanticAdapter, | ||
ScrapyItemAdapter, | ||
) | ||
|
||
|
||
class WebPoetTestItemAdapter(ItemAdapter): | ||
"""A default adapter implementation""" | ||
|
||
# In case the user changes ItemAdapter.ADAPTER_CLASSES it's copied here. | ||
ADAPTER_CLASSES: Deque[Type[AdapterInterface]] = deque( | ||
[ | ||
ScrapyItemAdapter, | ||
DictAdapter, | ||
DataclassAdapter, | ||
AttrsAdapter, | ||
PydanticAdapter, | ||
] | ||
) |