|
1 | | -from dataclasses import is_dataclass |
2 | 1 | from datetime import timedelta |
3 | 2 |
|
4 | 3 | from virtualship.instruments.types import InstrumentType |
|
12 | 11 |
|
13 | 12 | def _assert_general_problem_class(cls): |
14 | 13 | assert isinstance(cls, GeneralProblem) |
15 | | - instance = cls() |
16 | | - assert is_dataclass(instance) |
17 | 14 |
|
18 | 15 | # required attributes and types |
19 | | - assert isinstance(instance.message, str) |
20 | | - assert instance.message.strip(), "message should not be empty" |
| 16 | + assert isinstance(cls.message, str) |
| 17 | + assert cls.message.strip(), "message should not be empty" |
21 | 18 |
|
22 | | - assert isinstance(instance.delay_duration, timedelta) |
23 | | - assert isinstance(instance.pre_departure, bool) |
| 19 | + assert isinstance(cls.delay_duration, timedelta) |
| 20 | + assert isinstance(cls.pre_departure, bool) |
24 | 21 |
|
25 | 22 |
|
26 | 23 | def _assert_instrument_problem_class(cls): |
27 | 24 | assert isinstance(cls, InstrumentProblem) |
28 | | - instance = cls() |
29 | | - assert is_dataclass(instance) |
30 | 25 |
|
31 | 26 | # required attributes and types |
32 | | - assert isinstance(instance.message, str) |
33 | | - assert instance.message.strip(), "message should not be empty" |
| 27 | + assert isinstance(cls.message, str) |
| 28 | + assert cls.message.strip(), "message should not be empty" |
34 | 29 |
|
35 | | - assert isinstance(instance.delay_duration, timedelta) |
36 | | - assert isinstance(instance.instrument_type, InstrumentType) |
| 30 | + assert isinstance(cls.delay_duration, timedelta) |
| 31 | + assert isinstance(cls.instrument_type, InstrumentType) |
37 | 32 |
|
38 | 33 |
|
39 | 34 | def test_general_problems(): |
|
0 commit comments