Exemplo n.º 1
0
    def test_balanced_constructor(self, exp_factory):
        exp1 = exp_factory()
        seed = 12348
        rd1 = cond.ListRandomizer.balanced("a",
                                           "b",
                                           n=10,
                                           exp=exp1,
                                           random_seed=seed)
        exp1.condition = rd1.get_condition()

        exp2 = exp_factory()
        rd2 = cond.ListRandomizer(("a", 10), ("b", 10),
                                  exp=exp2,
                                  random_seed=seed)
        exp2.condition = rd2.get_condition()

        slots1 = [s.condition for s in rd1.slotlist.slots]
        slots2 = [s.condition for s in rd2.slotlist.slots]
        assert slots1 == slots2
Exemplo n.º 2
0
    def test_increase_version(self, strict_exp):
        strict_exp.config.read_dict({"metadata": {"version": "0.2"}})
        assert strict_exp.version == "0.2"

        rd = cond.ListRandomizer(("a", 10), exp=strict_exp)
        assert rd.get_condition()
Exemplo n.º 3
0
 def test_remove_condition(self, strict_exp):
     rd = cond.ListRandomizer(("a", 10), exp=strict_exp)
     with pytest.raises(ConditionInconsistency):
         rd.get_condition()
Exemplo n.º 4
0
    def test_change_of_name(self, strict_exp):

        rd = cond.ListRandomizer(("a", 10), ("c", 10), exp=strict_exp)
        with pytest.raises(ConditionInconsistency):
            rd.get_condition()
Exemplo n.º 5
0
 def test_change_mode(self, strict_exp):
     rd = cond.ListRandomizer(("a", 10), ("b", 10),
                              exp=strict_exp,
                              mode="inclusive")
     assert rd.get_condition()
Exemplo n.º 6
0
 def test_pass_validation(self, strict_exp):
     rd = cond.ListRandomizer(("a", 10), ("b", 10), exp=strict_exp)
     assert rd.get_condition()
Exemplo n.º 7
0
def strict_exp(exp):
    rd = cond.ListRandomizer(("a", 10), ("b", 10), exp=exp)
    exp.condition = rd.get_condition()
    yield exp
Exemplo n.º 8
0
def rd_slots(*conditions, exp, seed):
    rd = cond.ListRandomizer(*conditions, exp=exp, random_seed=seed)
    rd.get_condition()

    rd_slots = [slot.condition for slot in rd.slotlist.slots]
    return rd_slots