def test_json_field_parser(): json_property = Property.parse_raw( '{"obj": "properties.Property", "name": "users.additional_data ->> title", "alias": "title"}' ) assert json_property.name == "users.additional_data ->> title" assert str( json_property) == "users.additional_data ->> 'title' AS \"title\""
def test_json_nested_field_parser(): json_property = Property.parse_raw( '{"obj": "properties.Property", "name": "users.additional_data -> custom_fields ->> age", "alias": "age"}' ) assert json_property.name == "users.additional_data -> custom_fields ->> age" assert str( json_property ) == "users.additional_data -> 'custom_fields' ->> 'age' AS \"age\""
def test_json_serialize(valid_instance: Property): assert valid_instance == Property.parse_raw( '{"obj": "properties.Property", "name": "users.name", "alias": "name"}' )