Ejemplo n.º 1
0
def test_entity_set_value_values_missing():
    body = "four"
    entity = BaseEntity(
        range={"from": 0, "to": len(body)},
        body=body,
        dim="default",
        type="basic",
    )
    entity.set_value(value=4)
    assert entity.value == 4
Ejemplo n.º 2
0
def test_entity_jsonify() -> None:
    body = "12th december"
    value = "value"
    values = [{"key": value}]
    entity = BaseEntity(
        range={"from": 0, "to": len(body)},
        body=body,
        dim="default",
        type="basic",
        values=values,
    )
    entity.set_value(value)
    entity_json = entity.json()
    assert "dim" not in entity_json
    assert entity_json.get("value") == value