-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
create consume_modules() to properly load annotations in get_overrides()
- Loading branch information
Showing
6 changed files
with
131 additions
and
7 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
""" | ||
This test package was created separately to see the behavior of retrieving the | ||
Override rules declared on a registry where @handle_urls is defined on another | ||
package. | ||
""" |
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,28 @@ | ||
""" | ||
This package quite is similar to tests/po_lib_sub in terms of code contents. | ||
What we're ultimately trying to test here is to see if the `default_registry` | ||
captures the rules annotated in this module if it was not imported. | ||
""" | ||
from typing import Dict, Any, Callable | ||
|
||
from url_matcher import Patterns | ||
|
||
from web_poet import handle_urls | ||
|
||
|
||
class POBase: | ||
expected_overrides: Callable | ||
expected_patterns: Patterns | ||
expected_meta: Dict[str, Any] | ||
|
||
|
||
class POLibSubOverridenNotImported: | ||
... | ||
|
||
|
||
@handle_urls("sub_example_not_imported.com", POLibSubOverridenNotImported) | ||
class POLibSubNotImported(POBase): | ||
expected_overrides = POLibSubOverridenNotImported | ||
expected_patterns = Patterns(["sub_example_not_imported.com"]) | ||
expected_meta = {} # type: ignore |
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
from .pages import WebPage, ItemPage, ItemWebPage, Injectable | ||
from .page_inputs import ResponseData | ||
from .overrides import handle_urls, PageObjectRegistry, default_registry | ||
from .overrides import handle_urls, PageObjectRegistry, default_registry, consume_modules |
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