Passed
Push — main ( ed7d21...87238c )
by Douglas
01:43
created

pocketutils.core.mocks.MockWritable.flush()   A

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 1
dl 0
loc 2
rs 10
c 0
b 0
f 0
1
from typing import Any, Self
2
3
4
class MockWritable:
5
    def __init__(self: Self) -> None:
6
        self.data = None
7
8
    def write(self, data: Any) -> int:
9
        self.data = "write:" + str(data)
10
        return len(data)
11
12
    def flush(self: Self) -> None:
13
        self.data += "flush"
14
15
    def close(self: Self) -> None:
16
        self.data += "close"
17
18
19
class MockCallable:
20
    def __init__(self: Self) -> None:
21
        self.data = None
22
23
    def __call__(self, data: Self) -> None:
24
        self.data = "call:" + data
25
26
27
class WritableCallable(MockWritable, MockCallable):
28
    pass
29