示例#1
0
def test_items(model):

    assert 'm1' in model.megacomplex
    assert 'm2' in model.megacomplex

    assert 't1' in model.test
    t = model.get_test('t1')
    assert t.param.full_label == "foo"
    assert t.megacomplex == 'm1'
    assert [p.full_label for p in t.param_list] == ["bar", "baz"]
    assert t.default_item == 42
    assert ('s1', 's2') in t.complex
    assert t.complex[('s1', 's2')].full_label == "baz"
    assert 't2' in model.test
    t = model.get_test('t2')
    assert t.param.full_label == "baz"
    assert t.megacomplex == 'm2'
    assert [p.full_label for p in t.param_list] == ["foo"]
    assert t.default_item == 7
    assert t.complex == {}

    assert 'dataset1' in model.dataset
    assert model.get_dataset('dataset1').megacomplex == ['m1', 'm2']
    assert model.get_dataset('dataset1').scale.full_label == 'scale_1'

    assert 'dataset2' in model.dataset
    assert model.get_dataset('dataset2').megacomplex == ['m2']
    assert model.get_dataset('dataset2').scale.full_label == 'scale_2'
示例#2
0
def test_items(model):

    assert 'm1' in model.megacomplex
    assert 'm2' in model.megacomplex

    assert 't1' in model.test
    t = model.get_test('t1')
    assert t.param.full_label == "foo"
    assert t.megacomplex == 'm1'
    assert [p.full_label for p in t.param_list] == ["bar", "baz"]
    assert t.default_item == 42
    assert ('s1', 's2') in t.complex
    assert t.complex[('s1', 's2')].full_label == "baz"
    assert 't2' in model.test
    t = model.get_test('t2')
    assert t.param.full_label == "baz"
    assert t.megacomplex == 'm2'
    assert [p.full_label for p in t.param_list] == ["foo"]
    assert t.default_item == 7
    assert t.complex == {}

    assert 'dataset1' in model.dataset
    assert model.get_dataset('dataset1').megacomplex == ['m1', 'm2']
    assert model.get_dataset('dataset1').scale.full_label == 'scale_1'

    assert 'dataset2' in model.dataset
    assert model.get_dataset('dataset2').megacomplex == ['m2']
    assert model.get_dataset('dataset2').scale.full_label == 'scale_2'
示例#3
0
def test_items(model):

    assert "m1" in model.megacomplex
    assert "m2" in model.megacomplex

    assert "t1" in model.test
    t = model.get_test("t1")
    assert t.param.full_label == "foo"
    assert t.megacomplex == "m1"
    assert [p.full_label for p in t.param_list] == ["bar", "baz"]
    assert t.default_item == 42
    assert ("s1", "s2") in t.complex
    assert t.complex[("s1", "s2")].full_label == "baz"
    assert "t2" in model.test
    t = model.get_test("t2")
    assert t.param.full_label == "baz"
    assert t.megacomplex == "m2"
    assert [p.full_label for p in t.param_list] == ["foo"]
    assert t.default_item == 7
    assert t.complex == {}

    assert "dataset1" in model.dataset
    assert model.get_dataset("dataset1").megacomplex == ["m1", "m2"]
    assert model.get_dataset("dataset1").scale.full_label == "scale_1"

    assert "dataset2" in model.dataset
    assert model.get_dataset("dataset2").megacomplex == ["m2"]
    assert model.get_dataset("dataset2").scale.full_label == "scale_2"

    assert len(model.weights) == 1
    w = model.weights[0]
    assert w.datasets == ["d1", "d2"]
    assert w.global_interval == (1, 4)
    assert w.model_interval == (2, 3)
    assert w.value == 5.4
示例#4
0
def test_fill(model, parameter):
    dataset = model.get_dataset('dataset1').fill(model, parameter)
    assert [cmplx.label for cmplx in dataset.megacomplex] == ['m1', 'm2']
    assert dataset.scale == 2

    dataset = model.get_dataset('dataset2').fill(model, parameter)
    assert [cmplx.label for cmplx in dataset.megacomplex] == ['m2']
    assert dataset.scale == 8

    t = model.get_test('t1').fill(model, parameter)
    assert t.param == 3
    assert t.megacomplex.label == 'm1'
    assert t.param_list == [4, 2]
    assert t.default_item == 42
    assert t.complex == {('s1', 's2'): 2}
    t = model.get_test('t2').fill(model, parameter)
    assert t.param == 2
    assert t.megacomplex.label == 'm2'
    assert t.param_list == [3]
    assert t.default_item == 7
    assert t.complex == {}
示例#5
0
def test_fill(model, parameter):
    dataset = model.get_dataset('dataset1').fill(model, parameter)
    assert [cmplx.label for cmplx in dataset.megacomplex] == ['m1', 'm2']
    assert dataset.scale == 2

    dataset = model.get_dataset('dataset2').fill(model, parameter)
    assert [cmplx.label for cmplx in dataset.megacomplex] == ['m2']
    assert dataset.scale == 8

    t = model.get_test('t1').fill(model, parameter)
    assert t.param == 3
    assert t.megacomplex.label == 'm1'
    assert t.param_list == [4, 2]
    assert t.default_item == 42
    assert t.complex == {('s1', 's2'): 2}
    t = model.get_test('t2').fill(model, parameter)
    assert t.param == 2
    assert t.megacomplex.label == 'm2'
    assert t.param_list == [3]
    assert t.default_item == 7
    assert t.complex == {}
示例#6
0
def test_fill(model, parameter):
    dataset = model.get_dataset("dataset1").fill(model, parameter)
    assert [cmplx.label for cmplx in dataset.megacomplex] == ["m1", "m2"]
    assert dataset.scale == 2

    dataset = model.get_dataset("dataset2").fill(model, parameter)
    assert [cmplx.label for cmplx in dataset.megacomplex] == ["m2"]
    assert dataset.scale == 8

    t = model.get_test("t1").fill(model, parameter)
    assert t.param == 3
    assert t.megacomplex.label == "m1"
    assert t.param_list == [4, 2]
    assert t.default_item == 42
    assert t.complex == {("s1", "s2"): 2}
    t = model.get_test("t2").fill(model, parameter)
    assert t.param == 2
    assert t.megacomplex.label == "m2"
    assert t.param_list == [3]
    assert t.default_item == 7
    assert t.complex == {}