Skip to content

Commit

Permalink
Add scenarios with type hinting of non-injectable dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
Gallaecio committed Jan 22, 2025
1 parent 5db3d5f commit 58cbe87
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_injection.py
Original file line number Diff line number Diff line change
Expand Up @@ -1145,6 +1145,18 @@ def parse_deps(self, response, foo=VALUE, injected: Injected = None): # type: i
self.success = expected_injected(injected) and foo == "bar"


class CbSpider17(BaseCbSpider):

def parse_deps(self, response, injected: Injected, foo: Cls2 = VALUE):
self.success = expected_injected(injected) and foo is VALUE


class CbSpider18(BaseCbSpider):

def parse_deps(self, response, injected: Injected, foo: Optional[Cls2] = VALUE):
self.success = expected_injected(injected) and foo is VALUE


@pytest.mark.parametrize(
("spider_cls",),
((cls,) for cls in BaseCbSpider.__subclasses__()),
Expand Down

0 comments on commit 58cbe87

Please sign in to comment.