test_alias_to_constructor_skipped   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 12
dl 0
loc 23
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_an_alias_doesnt_skip_a_defined_constructor() 0 6 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A Something.__init__() 0 2 1
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