Skip to content

Commit f2e321c

Browse files
committed
refactor: Rename functions
1 parent 3e4c184 commit f2e321c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

injector_test.py

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1590,114 +1590,114 @@ def test_binder_has_implicit_binding_for_implicitly_bound_type():
15901590

15911591

15921592
def test_gets_no_bindings_without_injection() -> None:
1593-
def function1(a: int) -> None:
1593+
def function(a: int) -> None:
15941594
pass
15951595

1596-
assert get_bindings(function1) == {}
1596+
assert get_bindings(function) == {}
15971597

15981598

15991599
def test_gets_bindings_with_inject_decorator() -> None:
16001600
@inject
1601-
def function2(a: int) -> None:
1601+
def function(a: int) -> None:
16021602
pass
16031603

1604-
assert get_bindings(function2) == {'a': int}
1604+
assert get_bindings(function) == {'a': int}
16051605

16061606

16071607
def test_gets_multiple_bindings_with_inject_decorator() -> None:
16081608
@inject
1609-
def function2(a: int, b: str) -> None:
1609+
def function(a: int, b: str) -> None:
16101610
pass
16111611

1612-
assert get_bindings(function2) == {'a': int, 'b': str}
1612+
assert get_bindings(function) == {'a': int, 'b': str}
16131613

16141614

16151615
def test_only_gets_injectable_bindings_without_noninjectable_decorator() -> None:
16161616
@inject
16171617
@noninjectable('b')
1618-
def function3(a: int, b: str) -> None:
1618+
def function1(a: int, b: str) -> None:
16191619
pass
16201620

16211621
# Let's verify that the inject/noninjectable ordering doesn't matter
16221622
@noninjectable('b')
16231623
@inject
1624-
def function3b(a: int, b: str) -> None:
1624+
def function2(a: int, b: str) -> None:
16251625
pass
16261626

1627-
assert get_bindings(function3) == {'a': int} == get_bindings(function3b)
1627+
assert get_bindings(function1) == {'a': int} == get_bindings(function2)
16281628

16291629

16301630
def test_gets_bindings_with_inject_annotation() -> None:
1631-
def function4(a: Inject[int], b: str) -> None:
1631+
def function(a: Inject[int], b: str) -> None:
16321632
pass
16331633

1634-
assert get_bindings(function4) == {'a': int}
1634+
assert get_bindings(function) == {'a': int}
16351635

16361636

16371637
def test_gets_multiple_bindings_with_inject_annotation() -> None:
1638-
def function4(a: Inject[int], b: Inject[str]) -> None:
1638+
def function(a: Inject[int], b: Inject[str]) -> None:
16391639
pass
16401640

1641-
assert get_bindings(function4) == {'a': int, 'b': str}
1641+
assert get_bindings(function) == {'a': int, 'b': str}
16421642

16431643

16441644
def test_gets_bindings_inject_with_redundant_inject_annotation() -> None:
16451645
@inject
1646-
def function5(a: Inject[int], b: str) -> None:
1646+
def function(a: Inject[int], b: str) -> None:
16471647
pass
16481648

1649-
assert get_bindings(function5) == {'a': int, 'b': str}
1649+
assert get_bindings(function) == {'a': int, 'b': str}
16501650

16511651

16521652
def test_only_gets_bindings_without_noinject_annotation() -> None:
16531653
@inject
1654-
def function6(a: int, b: NoInject[str]) -> None:
1654+
def function(a: int, b: NoInject[str]) -> None:
16551655
pass
16561656

1657-
assert get_bindings(function6) == {'a': int}
1657+
assert get_bindings(function) == {'a': int}
16581658

16591659

16601660
def test_gets_no_bindings_for_noinject_annotation_only() -> None:
1661-
def function7(a: int, b: NoInject[str]) -> None:
1661+
def function(a: int, b: NoInject[str]) -> None:
16621662
pass
16631663

1664-
assert get_bindings(function7) == {}
1664+
assert get_bindings(function) == {}
16651665

16661666

16671667
def test_gets_no_bindings_for_multiple_noinject_annotations() -> None:
16681668
# There was a bug where in case of multiple NoInject-decorated parameters only the first one was
16691669
# actually made noninjectable and we tried to inject something we couldn't possibly provide
16701670
# into the second one.
16711671
@inject
1672-
def function8(a: NoInject[int], b: NoInject[int]) -> None:
1672+
def function(a: NoInject[int], b: NoInject[int]) -> None:
16731673
pass
16741674

1675-
assert get_bindings(function8) == {}
1675+
assert get_bindings(function) == {}
16761676

16771677

16781678
def test_get_bindings_noinject_with_default_should_behave_identically() -> None:
16791679
@inject
16801680
@noninjectable('b')
1681-
def function9(self, a: int, b: Optional[str] = None) -> None:
1681+
def function1(self, a: int, b: Optional[str] = None) -> None:
16821682
pass
16831683

16841684
@inject
1685-
def function10(self, a: int, b: NoInject[Optional[str]] = None) -> None:
1685+
def function2(self, a: int, b: NoInject[Optional[str]] = None) -> None:
16861686
# b's type is Union[NoInject[Union[str, None]], None]
16871687
pass
16881688

1689-
assert get_bindings(function9) == {'a': int} == get_bindings(function10)
1689+
assert get_bindings(function1) == {'a': int} == get_bindings(function2)
16901690

16911691

16921692
def test_get_bindings_with_an_invalid_forward_reference_return_type() -> None:
16931693
# If there's a return type annottion that contains an a forward reference that can't be
16941694
# resolved (for whatever reason) we don't want that to break things for us – return types
16951695
# don't matter for the purpose of dependency injection.
16961696
@inject
1697-
def function11(a: int) -> 'InvalidForwardReference':
1697+
def function(a: int) -> 'InvalidForwardReference':
16981698
pass
16991699

1700-
assert get_bindings(function11) == {'a': int}
1700+
assert get_bindings(function) == {'a': int}
17011701

17021702

17031703
# Tests https://github.com/alecthomas/injector/issues/202

0 commit comments

Comments
 (0)