test_ok2/testing/example_scripts/dataclasses/test_compare_dataclasses.py

15 lines
303 B
Python
Raw Normal View History

from dataclasses import dataclass
from dataclasses import field
def test_dataclasses() -> None:
@dataclass
2019-06-03 06:32:00 +08:00
class SimpleDataObject:
field_a: int = field()
field_b: str = field()
left = SimpleDataObject(1, "b")
right = SimpleDataObject(1, "c")
assert left == right