Skip to content

Commit

Permalink
Remove some no longer necessary code (#231)
Browse files Browse the repository at this point in the history
We no longer support Python versions old enough to warrant these
workarounds.
  • Loading branch information
jstasiak authored Sep 5, 2023
1 parent d7a1a7a commit 5610e2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 16 deletions.
4 changes: 0 additions & 4 deletions injector/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1119,10 +1119,6 @@ def get_bindings(callable: Callable) -> Dict[str, type]:
>>> get_bindings(function3)
{'a': <class 'int'>}
>>> import sys, pytest
>>> if sys.version_info < (3, 7, 0):
... pytest.skip('Python 3.7.0 required for sufficient Annotated support')
>>> # The simple case of no @inject but injection requested with Inject[...]
>>> def function4(a: Inject[int], b: str) -> None:
... pass
Expand Down
16 changes: 4 additions & 12 deletions injector_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -1544,21 +1544,13 @@ def configure(binder):
assert injector.get(UserID) == 123


@pytest.mark.skipif(sys.version_info < (3, 6), reason="Requires Python 3.6+")
def test_dataclass_integration_works():
import dataclasses

# Python 3.6+-only syntax below
exec(
"""
@inject
@dataclasses.dataclass
class Data:
name: str
""",
locals(),
globals(),
)
@inject
@dataclasses.dataclass
class Data:
name: str

def configure(binder):
binder.bind(str, to='data')
Expand Down

0 comments on commit 5610e2a

Please sign in to comment.