Skip to content

Commit 8ade2b7

Browse files
committed
Update quotes in tests
1 parent 0b1e214 commit 8ade2b7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+1285
-1287
lines changed

src/dependency_injector/providers.c

Lines changed: 17 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/dependency_injector/providers.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4051,7 +4051,7 @@ cdef class ProvidedInstance(Provider):
40514051
super().__init__()
40524052

40534053
def __repr__(self):
4054-
return f'{self.__class__.__name__}(\'{self.__provides}\')'
4054+
return f'{self.__class__.__name__}("{self.__provides}")'
40554055

40564056
def __deepcopy__(self, memo):
40574057
copied = memo.get(id(self))
@@ -4107,7 +4107,7 @@ cdef class AttributeGetter(Provider):
41074107
super().__init__()
41084108

41094109
def __repr__(self):
4110-
return f'{self.__class__.__name__}(\'{self.name}\')'
4110+
return f'{self.__class__.__name__}("{self.name}")'
41114111

41124112
def __deepcopy__(self, memo):
41134113
copied = memo.get(id(self))
@@ -4189,7 +4189,7 @@ cdef class ItemGetter(Provider):
41894189
super().__init__()
41904190

41914191
def __repr__(self):
4192-
return f'{self.__class__.__name__}(\'{self.name}\')'
4192+
return f'{self.__class__.__name__}("{self.name}")'
41934193

41944194
def __deepcopy__(self, memo):
41954195
copied = memo.get(id(self))

tests/performance/test.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -14,29 +14,29 @@ def __init__(self, provider_modules, duration_factor):
1414
self.provider_modules = provider_modules
1515
self.tests = [getattr(self, name)
1616
for name in dir(self)
17-
if name.startswith('test')]
17+
if name.startswith("test")]
1818
self.total_time = 0
1919
self.duration_factor = duration_factor
2020

2121
def run(self):
2222
"""Run all tests for all provider modules."""
2323
for module in self.provider_modules:
24-
print('\n')
25-
print('Running tests for module - "{module}":'
24+
print("\n")
25+
print("Running tests for module - \"{module}\":"
2626
.format(module=module.__name__))
2727

2828
gc.disable()
2929
for test in self.tests:
3030
start_time = time.time()
3131
test(module)
3232
self.total_time = time.time() - start_time
33-
print('Test "{test}" took - {time}'
33+
print("Test \"{test}\" took - {time}"
3434
.format(test=test.__name__,
3535
time=self.total_time))
3636
gc.collect()
3737

3838
gc.enable()
39-
print('\n')
39+
print("\n")
4040

4141
def test_raw_3_kw_injections(self, providers):
4242
"""Test 3 keyword argument injections."""
@@ -53,7 +53,7 @@ class Test(object):
5353
def __init__(self, a, b, c):
5454
pass
5555

56-
for x in xrange(int(5000000 * self.duration_factor)):
56+
for x in range(int(5000000 * self.duration_factor)):
5757
Test(a=A(), b=B(), c=C())
5858

5959
def test_factory_3_factory_kw_injections(self, providers):
@@ -78,7 +78,7 @@ def __init__(self, a, b, c):
7878
a=a_factory,
7979
b=b_factory,
8080
c=c_factory)
81-
for x in xrange(int(5000000 * self.duration_factor)):
81+
for x in range(int(5000000 * self.duration_factor)):
8282
test_factory()
8383

8484
def test_abstract_factory_3_factory_kw_injections(self, providers):
@@ -104,7 +104,7 @@ def __init__(self, a, b, c):
104104
a=a_factory,
105105
b=b_factory,
106106
c=c_factory))
107-
for x in xrange(int(5000000 * self.duration_factor)):
107+
for x in range(int(5000000 * self.duration_factor)):
108108
test_factory()
109109

110110
def test_factory_6_factory_kw_injections_0_context(self, providers):
@@ -114,7 +114,7 @@ def __init__(self, a, b, c, d, e, f):
114114
pass
115115

116116
test_factory = providers.Factory(Test, a=1, b=2, c=3, d=4, e=5, f=6)
117-
for x in xrange(int(5000000 * self.duration_factor)):
117+
for x in range(int(5000000 * self.duration_factor)):
118118
test_factory()
119119

120120
def test_factory_6_factory_kw_injections_1_context(self, providers):
@@ -124,7 +124,7 @@ def __init__(self, a, b, c, d, e, f):
124124
pass
125125

126126
test_factory = providers.Factory(Test, f=6)
127-
for x in xrange(int(5000000 * self.duration_factor)):
127+
for x in range(int(5000000 * self.duration_factor)):
128128
test_factory(a=1, b=2, c=3, d=4, e=5)
129129

130130
def test_factory_6_factory_kw_injections_3_context(self, providers):
@@ -134,11 +134,11 @@ def __init__(self, a, b, c, d, e, f):
134134
pass
135135

136136
test_factory = providers.Factory(Test, a=1, b=2, c=3)
137-
for x in xrange(int(5000000 * self.duration_factor)):
137+
for x in range(int(5000000 * self.duration_factor)):
138138
test_factory(d=4, e=5, f=6)
139139

140140

141-
if __name__ == '__main__':
141+
if __name__ == "__main__":
142142
tester = Tester(
143143
provider_modules=[
144144
dependency_injector.providers,

tests/typing/callable.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def create(cls) -> Animal:
1616

1717
# Test 1: to check the return type (class)
1818
provider1 = providers.Callable(Cat)
19-
animal1: Animal = provider1(1, 2, 3, b='1', c=2, e=0.0)
19+
animal1: Animal = provider1(1, 2, 3, b="1", c=2, e=0.0)
2020

2121
# Test 2: to check the return type (class factory method)
2222
provider2 = providers.Callable(Cat.create)
@@ -36,26 +36,26 @@ def create(cls) -> Animal:
3636
provider5 = providers.Callable(Animal)
3737
provided5: providers.ProvidedInstance = provider5.provided
3838
attr_getter5: providers.AttributeGetter = provider5.provided.attr
39-
item_getter5: providers.ItemGetter = provider5.provided['item']
39+
item_getter5: providers.ItemGetter = provider5.provided["item"]
4040
method_caller: providers.MethodCaller = provider5.provided.method.call(123, arg=324)
4141

4242
# Test 6: to check the DelegatedCallable
4343
provider6 = providers.DelegatedCallable(Cat)
44-
animal6: Animal = provider6(1, 2, 3, b='1', c=2, e=0.0)
44+
animal6: Animal = provider6(1, 2, 3, b="1", c=2, e=0.0)
4545

4646
# Test 7: to check the AbstractCallable
4747
provider7 = providers.AbstractCallable(Animal)
4848
provider7.override(providers.Callable(Cat))
49-
animal7: Animal = provider7(1, 2, 3, b='1', c=2, e=0.0)
49+
animal7: Animal = provider7(1, 2, 3, b="1", c=2, e=0.0)
5050

5151
# Test 8: to check the CallableDelegate __init__
5252
provider8 = providers.CallableDelegate(providers.Callable(lambda: None))
5353

5454
# Test 9: to check the return type with await
5555
provider9 = providers.Callable(Cat)
5656
async def _async9() -> None:
57-
animal1: Animal = await provider9(1, 2, 3, b='1', c=2, e=0.0) # type: ignore
58-
animal2: Animal = await provider9.async_(1, 2, 3, b='1', c=2, e=0.0)
57+
animal1: Animal = await provider9(1, 2, 3, b="1", c=2, e=0.0) # type: ignore
58+
animal2: Animal = await provider9.async_(1, 2, 3, b="1", c=2, e=0.0)
5959

6060
# Test 10: to check the .provides
6161
provider10 = providers.Callable(Cat)

tests/typing/configuration.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,12 @@
99
# Test 2: to check the from_*() method
1010
config2 = providers.Configuration()
1111
config2.from_dict({})
12-
config2.from_ini('config.ini')
13-
config2.from_ini(Path('config.ini'))
12+
config2.from_ini("config.ini")
13+
config2.from_ini(Path("config.ini"))
1414

15-
config2.from_yaml('config.yml')
16-
config2.from_yaml(Path('config.yml'))
17-
config2.from_env('ENV', 'default')
15+
config2.from_yaml("config.yml")
16+
config2.from_yaml(Path("config.yml"))
17+
config2.from_env("ENV", "default")
1818

1919
# Test 3: to check as_*() methods
2020
config3 = providers.Configuration()

tests/typing/declarative_container.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,4 @@ class Container7(containers.DeclarativeContainer):
6363
provider = providers.Factory(str)
6464

6565
container7 = Container7()
66-
container7.override_providers(provider='new_value')
66+
container7.override_providers(provider="new_value")

tests/typing/factory.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def create(cls) -> Animal:
1818

1919
# Test 1: to check the return type (class)
2020
provider1 = providers.Factory(Cat)
21-
animal1: Animal = provider1(1, 2, 3, b='1', c=2, e=0.0)
21+
animal1: Animal = provider1(1, 2, 3, b="1", c=2, e=0.0)
2222

2323
# Test 2: to check the return type (class factory method)
2424
provider2 = providers.Factory(Cat.create)
@@ -39,17 +39,17 @@ def create(cls) -> Animal:
3939
provider5 = providers.Factory(Animal)
4040
provided5: providers.ProvidedInstance = provider5.provided
4141
attr_getter5: providers.AttributeGetter = provider5.provided.attr
42-
item_getter5: providers.ItemGetter = provider5.provided['item']
42+
item_getter5: providers.ItemGetter = provider5.provided["item"]
4343
method_caller5: providers.MethodCaller = provider5.provided.method.call(123, arg=324)
4444

4545
# Test 6: to check the DelegatedFactory
4646
provider6 = providers.DelegatedFactory(Cat)
47-
animal6: Animal = provider6(1, 2, 3, b='1', c=2, e=0.0)
47+
animal6: Animal = provider6(1, 2, 3, b="1", c=2, e=0.0)
4848

4949
# Test 7: to check the AbstractFactory
5050
provider7 = providers.AbstractFactory(Animal)
5151
provider7.override(providers.Factory(Cat))
52-
animal7: Animal = provider7(1, 2, 3, b='1', c=2, e=0.0)
52+
animal7: Animal = provider7(1, 2, 3, b="1", c=2, e=0.0)
5353

5454
# Test 8: to check the FactoryDelegate __init__
5555
provider8 = providers.FactoryDelegate(providers.Factory(object))
@@ -61,7 +61,7 @@ def create(cls) -> Animal:
6161
)
6262
factory_a_9: providers.Factory[str] = provider9.a
6363
factory_b_9: providers.Factory[str] = provider9.b
64-
val9: str = provider9('a')
64+
val9: str = provider9("a")
6565

6666
provider9_set_non_string_keys: providers.FactoryAggregate[str] = providers.FactoryAggregate()
6767
provider9_set_non_string_keys.set_factories({Cat: providers.Factory(str, "str")})
@@ -83,8 +83,8 @@ def create(cls) -> Animal:
8383
# Test 11: to check the return type with await
8484
provider11 = providers.Factory(Cat)
8585
async def _async11() -> None:
86-
animal1: Animal = await provider11(1, 2, 3, b='1', c=2, e=0.0) # type: ignore
87-
animal2: Animal = await provider11.async_(1, 2, 3, b='1', c=2, e=0.0)
86+
animal1: Animal = await provider11(1, 2, 3, b="1", c=2, e=0.0) # type: ignore
87+
animal2: Animal = await provider11.async_(1, 2, 3, b="1", c=2, e=0.0)
8888

8989
# Test 12: to check class type from .provides
9090
provider12 = providers.Factory(Cat)

tests/typing/list.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
)
2626
provided3: providers.ProvidedInstance = provider3.provided
2727
attr_getter3: providers.AttributeGetter = provider3.provided.attr
28-
item_getter3: providers.ItemGetter = provider3.provided['item']
28+
item_getter3: providers.ItemGetter = provider3.provided["item"]
2929
method_caller3: providers.MethodCaller = provider3.provided.method.call(123, arg=324)
3030

3131
# Test 4: to check the return type with await

0 commit comments

Comments
 (0)