Skip to content

Commit 25c5b67

Browse files
committed
black
1 parent 334a9b1 commit 25c5b67

8 files changed

Lines changed: 24 additions & 28 deletions

File tree

tests/typing/configuration.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@
8181
config5_pydantic.set_pydantic_settings([PydanticSettings()])
8282

8383
# NOTE: Using assignment since PydanticSettings is context-sensitive: conditional on whether pydantic is installed
84-
config5_pydantic_settings: list[PydanticSettings] = (config5_pydantic.get_pydantic_settings())
84+
config5_pydantic_settings: list[PydanticSettings] = (
85+
config5_pydantic.get_pydantic_settings()
86+
)
8587

8688
# Test 6: to check init arguments
8789
config6 = providers.Configuration(

tests/typing/declarative_container.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class Container5(containers.DeclarativeContainer):
5252
dependencies = Container5.dependencies
5353
assert_type(dependencies, Dict[str, providers.Provider[Any]])
5454

55+
5556
# Test 6: to check base class
5657
class Container6(containers.DeclarativeContainer):
5758
provider = providers.Factory(int)

tests/typing/dict.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
assert_type(var1, Dict[Any, Any])
1313

1414

15-
1615
# Test 2: to check init with non-string keys
1716
provider2 = providers.Dict({object(): providers.Factory(object)})
1817
var2 = provider2()
@@ -42,7 +41,7 @@
4241
a2=providers.Factory(object),
4342
)
4443
provided5 = provider5.provided()
45-
assert_type(provided5, Any)
44+
assert_type(provided5, Any)
4645

4746

4847
# Test 6: to check the return type with await

tests/typing/factory.py

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def create(cls) -> Animal:
3535
# Test 4: to check the .args, .kwargs, .attributes attributes
3636
provider4 = providers.Factory(Animal)
3737
args4 = provider4.args
38-
kwargs4 = provider4.kwargs
38+
kwargs4 = provider4.kwargs
3939
attributes4 = provider4.attributes
4040
assert_type(args4, Tuple[Any])
4141
assert_type(kwargs4, Dict[str, Any])
@@ -81,33 +81,23 @@ def create(cls) -> Animal:
8181
assert_type(factory_b_9, providers.Factory[str])
8282
assert_type(val9, str)
8383

84-
provider9_set_non_string_keys = (
85-
providers.FactoryAggregate[str]()
86-
)
84+
provider9_set_non_string_keys = providers.FactoryAggregate[str]()
8785
provider9_set_non_string_keys.set_factories({Cat: providers.Factory(str, "str")})
88-
factory_set_non_string_9 = (
89-
provider9_set_non_string_keys.factories[Cat]
90-
)
86+
factory_set_non_string_9 = provider9_set_non_string_keys.factories[Cat]
9187
assert_type(provider9_set_non_string_keys, providers.FactoryAggregate[str])
9288
assert_type(factory_set_non_string_9, providers.Factory[str])
9389

94-
provider9_new_non_string_keys = (
95-
providers.FactoryAggregate(
96-
{Cat: providers.Factory(str, "str")},
97-
)
98-
)
99-
factory_new_non_string_9 = (
100-
provider9_new_non_string_keys.factories[Cat]
90+
provider9_new_non_string_keys = providers.FactoryAggregate(
91+
{Cat: providers.Factory(str, "str")},
10192
)
93+
factory_new_non_string_9 = provider9_new_non_string_keys.factories[Cat]
10294
assert_type(provider9_new_non_string_keys, providers.FactoryAggregate[str])
10395
assert_type(factory_new_non_string_9, providers.Factory[str])
10496

10597
provider9_no_explicit_typing = providers.FactoryAggregate(
10698
a=providers.Factory(str, "str")
10799
)
108-
provider9_no_explicit_typing_factory = (
109-
provider9_no_explicit_typing.factories["a"]
110-
)
100+
provider9_no_explicit_typing_factory = provider9_no_explicit_typing.factories["a"]
111101
provider9_no_explicit_typing_object = provider9_no_explicit_typing("a")
112102
assert_type(provider9_no_explicit_typing, providers.FactoryAggregate[str])
113103
assert_type(provider9_no_explicit_typing_factory, providers.Factory[str])

tests/typing/object.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ async def _async3() -> None:
3535
# Test 4: to check class type from provider
3636
provider4 = providers.Object(int("1"))
3737
provided_provides4 = provider4.provides
38-
assert_type(provided_provides4, Optional[int])
38+
assert_type(provided_provides4, Optional[int])

tests/typing/provider.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@
2323
r3 = provider2.is_async_mode_undefined()
2424
assert_type(r1, bool)
2525
assert_type(r2, bool)
26-
assert_type(r3, bool)
26+
assert_type(r3, bool)

tests/typing/resource.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ def init3() -> Generator[List[int], None, None]:
4444
var3 = provider3()
4545
assert_type(var3, List[int])
4646

47+
4748
# Test 4: to check the return type with resource subclass
4849
class MyResource4(resources.Resource[List[int]]):
4950
def init(self, *args: Any, **kwargs: Any) -> List[int]:
@@ -125,10 +126,10 @@ async def _provide8() -> None:
125126
class MyResource10:
126127
def __init__(self) -> None:
127128
pass
128-
129+
129130
def __enter__(self) -> Self:
130131
return self
131-
132+
132133
def __exit__(self, *args: Any, **kwargs: Any) -> None:
133134
return None
134135

@@ -153,10 +154,10 @@ def init11() -> Iterator[int]:
153154
class MyResource12:
154155
def __init__(self) -> None:
155156
pass
156-
157+
157158
async def __aenter__(self) -> Self:
158159
return self
159-
160+
160161
async def __aexit__(self, *args: Any, **kwargs: Any) -> None:
161162
return None
162163

@@ -178,6 +179,7 @@ async def init13() -> AsyncIterator[int]:
178179

179180
provider13 = providers.Resource(init13)
180181

182+
181183
async def _provide13() -> None:
182184
var1 = await provider13() # type: ignore
183185
var2 = await provider13.async_()

tests/typing/selector.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,9 @@ async def _async4() -> None:
7777
assert_type(provider6_after_set_providers, providers.Selector[Any])
7878

7979
# Test 7: to check explicit typing: return type, getattr, getter/setter of providers and selectors
80-
provider7 = providers.Selector[bool](lambda: "a", a=providers.Factory(bool), b=providers.Factory(int))
80+
provider7 = providers.Selector[bool](
81+
lambda: "a", a=providers.Factory(bool), b=providers.Factory(int)
82+
)
8183
var7 = provider7()
8284
attr7 = provider7.a
8385
assert_type(var7, bool)
@@ -93,4 +95,4 @@ async def _async4() -> None:
9395
c=providers.Factory(str)
9496
) # We don't require Provider of subclass of bool yet since Provider is invariant
9597
assert_type(providers7, Dict[str, providers.Provider[bool]])
96-
assert_type(provider7_after_set_providers, providers.Selector[bool])
98+
assert_type(provider7_after_set_providers, providers.Selector[bool])

0 commit comments

Comments
 (0)