예제 #1
0
def test_dict_round_trip():
    v_orig = Value("A", uid="337f7234-85a1-45a0-be77-0934ec232f21")
    value_dict = v_orig.to_dict()
    v_new = Value.from_dict(value_dict)

    assert v_new == v_orig
    assert v_new.uid == v_orig.uid
예제 #2
0
def test_to_dict():
    v = Value("A", uid="337f7234-85a1-45a0-be77-0934ec232f21")
    expected = {
        "name": "A",
        "uid": "337f7234-85a1-45a0-be77-0934ec232f21"
    }
    assert v.to_dict() == expected
예제 #3
0
def test_init_name_list_str():
    p = Parameter("Z", ["A", "B"])

    assert p.name == "Z"

    v1 = Value("A", uid=p.values[0].uid)
    v2 = Value("B", uid=p.values[1].uid)
    assert p.values == [v1, v2]
예제 #4
0
def test_create_with_values():
    p = Parameter.create_with_unnamed_values("Z", 4)

    assert p.name == "Z"

    v1 = Value("1", uid=p.values[0].uid)
    v2 = Value("2", uid=p.values[1].uid)
    v3 = Value("3", uid=p.values[2].uid)
    v4 = Value("4", uid=p.values[3].uid)

    assert p.values == [v1, v2, v3, v4]
예제 #5
0
def test_from_dict():
    v_dict = {
        "name": "A",
        "uid": "337f7234-85a1-45a0-be77-0934ec232f21"
    }
    v = Value.from_dict(v_dict)
    assert v.name == "A"
    assert str(v.uid) == "337f7234-85a1-45a0-be77-0934ec232f21"
예제 #6
0
def eighties():
    return Value("80s", uid=11)
예제 #7
0
def slow():
    return Value("Slow", uid=9)
예제 #8
0
def fast():
    return Value("Fast", uid=7)
예제 #9
0
def cat():
    return Value("Cat", uid=5)
예제 #10
0
def blue():
    return Value("Blue", uid=3)
예제 #11
0
def red():
    return Value("Red", uid=1)
예제 #12
0
def c1():
    return Value("C1")
예제 #13
0
def b3():
    return Value("B3")
예제 #14
0
def b2():
    return Value("B2")
예제 #15
0
def b1():
    return Value("B1")
예제 #16
0
def e2():
    return Value("E2")
예제 #17
0
import numpy as np
import pandas as pd

from tconfig.core.data import Value, Parameter, ParameterSet, ConfigurationSet, DEFAULT_NDARRAY_TYPE

RED = Value("Red")
GREEN = Value("Green")
BLUE = Value("Blue")

BIRD = Value("Bird")
CAT = Value("Cat")
DOG = Value("Dog")
FISH = Value("Fish")

FAST = Value("Fast")
MEDIUM = Value("Medium")
SLOW = Value("Slow")

SEVENTIES = Value("70s")
EIGHTIES = Value("80s")
TWENTIES = Value("20s")


def test_generate_configurations():
    """
    Verify that a parameter set and a covering array with
    no "don't care" values present is correctly converted
    to a data frame with the correct column headings and
    value names.
    """
    p1 = Parameter("Colour", [RED, GREEN, BLUE])
예제 #18
0
def c2():
    return Value("C2")
예제 #19
0
def green():
    return Value("Green", uid=2)
예제 #20
0
def c3():
    return Value("C3")
예제 #21
0
def bird():
    return Value("Bird", uid=4)
예제 #22
0
def d1():
    return Value("D1")
예제 #23
0
def dog():
    return Value("Dog", uid=6)
예제 #24
0
def d2():
    return Value("D2")
예제 #25
0
def medium():
    return Value("Medium", uid=8)
예제 #26
0
def d3():
    return Value("D3")
예제 #27
0
def seventies():
    return Value("70s", uid=10)
예제 #28
0
def d4():
    return Value("D4")
예제 #29
0
def twenties():
    return Value("20s", uid=12)
예제 #30
0
def e1():
    return Value("E1")