aboutsummaryrefslogtreecommitdiff
path: root/tests/models/thl/test_soft_pair.py
blob: bac0e8d6395b5213396b87be354bf30afe179b2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from generalresearch.models import Source
from generalresearch.models.thl.soft_pair import SoftPairResult, SoftPairResultType


def test_model():
    from generalresearch.models.dynata.survey import (
        DynataCondition,
        ConditionValueType,
    )

    c1 = DynataCondition(
        question_id="1", value_type=ConditionValueType.LIST, values=["a", "b"]
    )
    c2 = DynataCondition(
        question_id="2", value_type=ConditionValueType.LIST, values=["c", "d"]
    )
    sr = SoftPairResult(
        pair_type=SoftPairResultType.CONDITIONAL,
        source=Source.DYNATA,
        survey_id="xxx",
        conditions={c1, c2},
    )
    assert sr.grpc_string == "xxx:1;2"
    assert sr.survey_sid == "d:xxx"