Beispiel #1
0
def rd_slots(*conditions, exp, seed):
    rd = al.ListRandomizer(*conditions, exp=exp, random_seed=seed)
    rd.get_condition()

    data = rd.io.load()
    manager = SlotManager(data.slots)

    rd_slots = [slot.label for slot in manager.slots]
    return rd_slots
Beispiel #2
0
    def test_balanced_constructor(self, exp_factory):
        seed = 12348
        exp1 = exp_factory()
        rd1 = al.ListRandomizer.balanced("a",
                                         "b",
                                         n=10,
                                         exp=exp1,
                                         random_seed=seed)
        exp1.condition = rd1.get_condition()

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

        slots1 = [s.label for s in get_slots(rd1)]
        slots2 = [s.label for s in get_slots(rd2)]
        assert slots1 == slots2
Beispiel #3
0
    def test_increase_version(self, strict_exp):
        strict_exp.config.read_dict({"metadata": {"version": "0.2"}})
        assert strict_exp.version == "0.2"

        rd = al.ListRandomizer(("a", 10), exp=strict_exp)
        assert rd.get_condition()
Beispiel #4
0
 def test_remove_condition(self, strict_exp):
     rd = al.ListRandomizer(("a", 10), exp=strict_exp)
     with pytest.raises(ConditionInconsistency):
         rd.get_condition()
Beispiel #5
0
    def test_change_of_name(self, strict_exp):

        rd = al.ListRandomizer(("a", 10), ("c", 10), exp=strict_exp)
        with pytest.raises(ConditionInconsistency):
            rd.get_condition()
Beispiel #6
0
 def test_change_mode(self, strict_exp):
     rd = al.ListRandomizer(("a", 10), ("b", 10),
                            exp=strict_exp,
                            inclusive=True)
     assert rd.get_condition()
Beispiel #7
0
 def test_pass_validation(self, strict_exp):
     rd = al.ListRandomizer(("a", 10), ("b", 10), exp=strict_exp)
     assert rd.get_condition()
Beispiel #8
0
def strict_exp(exp):
    rd = al.ListRandomizer(("a", 10), ("b", 10), exp=exp)
    exp.condition = rd.get_condition()
    yield exp