def test_condition(): """Test that conditions are flattened and added""" condition = Value(name="spam", scalars=[Scalar(value="eggs")]) sys = System(properties=[ Property(name="foo", scalars=[Scalar(value="bar")], conditions=[condition]) ]) user_data = _to_user_defined(sys) assert user_data["spam"] == "eggs"
def test_property_list(): """Test that a property with a list of scalars gets pulled out""" sys = System(properties=[ Property(name="foo", scalars=[Scalar( value="spam"), Scalar(value="eggs")]) ]) user_data = _to_user_defined(sys) assert user_data["foo"] == ["spam", "eggs"]
def test_property_vector(): """Test that a vector gets pulled out""" sys = System(properties=[ Property(name="foo", units="bar", vectors=[[Scalar( value="spam"), Scalar(value="eggs")]]) ]) user_data = _to_user_defined(sys) assert user_data["foo_bar"] == ["spam", "eggs"]
def test_property_value(): """Test that a simple property gets pulled out""" sys = System( properties=[Property(name="foo", scalars=[Scalar(value="bar")])]) user_data = _to_user_defined(sys) assert user_data["foo"] == "bar"