def test_product_lines_serializes() -> None: ob = Line("z", 4, 5, 6) * Line("y", 2, 3, 5) * Line("x", 0, 1, 4) serialized = { "Product": { "outer": { "Product": { "outer": { "Line": { "axis": "z", "start": 4.0, "stop": 5.0, "num": 6 }, }, "inner": { "Line": { "axis": "y", "start": 2.0, "stop": 3.0, "num": 5 } }, } }, "inner": { "Line": { "axis": "x", "start": 0.0, "stop": 1.0, "num": 4 } }, } } assert ob.serialize() == serialized assert Spec.deserialize(serialized) == ob
def test_line_serializes() -> None: ob = Line("x", 0, 1, 4) serialized = {"Line": {"axis": "x", "start": 0.0, "stop": 1.0, "num": 4}} assert ob.serialize() == serialized assert Spec.deserialize(serialized) == ob