2018-11-13 05:36:16 +08:00
|
|
|
from dataclasses import dataclass
|
|
|
|
from dataclasses import field
|
|
|
|
|
|
|
|
|
2020-05-01 19:40:17 +08:00
|
|
|
def test_dataclasses_verbose() -> None:
|
2018-11-13 05:36:16 +08:00
|
|
|
@dataclass
|
|
|
|
class SimpleDataObject:
|
|
|
|
field_a: int = field()
|
2020-05-01 19:40:17 +08:00
|
|
|
field_b: str = field()
|
2018-11-13 05:36:16 +08:00
|
|
|
|
|
|
|
left = SimpleDataObject(1, "b")
|
|
|
|
right = SimpleDataObject(1, "c")
|
|
|
|
|
|
|
|
assert left == right
|