| Total Complexity | 6 |
| Total Lines | 36 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | # SPDX-FileCopyrightText: Copyright 2020-2023, Contributors to pocketutils |
||
| 2 | # SPDX-PackageHomePage: https://github.com/dmyersturnbull/pocketutils |
||
| 3 | # SPDX-License-Identifier: Apache-2.0 |
||
| 4 | """ |
||
| 5 | |||
| 6 | """ |
||
| 7 | |||
| 8 | from typing import Any, Self |
||
| 9 | |||
| 10 | |||
| 11 | class MockWritable: |
||
| 12 | def __init__(self: Self) -> None: |
||
| 13 | self.data = None |
||
| 14 | |||
| 15 | def write(self, data: Any) -> int: |
||
| 16 | self.data = "write:" + str(data) |
||
| 17 | return len(data) |
||
| 18 | |||
| 19 | def flush(self: Self) -> None: |
||
| 20 | self.data += "flush" |
||
| 21 | |||
| 22 | def close(self: Self) -> None: |
||
| 23 | self.data += "close" |
||
| 24 | |||
| 25 | |||
| 26 | class MockCallable: |
||
| 27 | def __init__(self: Self) -> None: |
||
| 28 | self.data = None |
||
| 29 | |||
| 30 | def __call__(self, data: Self) -> None: |
||
| 31 | self.data = "call:" + data |
||
| 32 | |||
| 33 | |||
| 34 | class WritableCallable(MockWritable, MockCallable): |
||
| 35 | pass |
||
| 36 |