Something.__init__()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 2
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nop 2
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
"""
2
https://github.com/meadsteve/lagom/issues/150
3
"""
4
5
from lagom import Container
6
7
8
class Something:
9
    def __init__(self, value="the default"):
10
        self.value = value
11
12
13
class SomethingInterface:
14
    value: str
15
16
17
def test_an_alias_doesnt_skip_a_defined_constructor():
18
    container = Container()
19
    container[Something] = lambda: Something("the correct value")
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Something does not seem to be defined.
Loading history...
20
    container[SomethingInterface] = Something  # type: ignore
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable Something does not seem to be defined.
Loading history...
21
22
    assert container[SomethingInterface].value == "the correct value"
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable SomethingInterface does not seem to be defined.
Loading history...
23