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
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
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]
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]
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"
def eighties(): return Value("80s", uid=11)
def slow(): return Value("Slow", uid=9)
def fast(): return Value("Fast", uid=7)
def cat(): return Value("Cat", uid=5)
def blue(): return Value("Blue", uid=3)
def red(): return Value("Red", uid=1)
def c1(): return Value("C1")
def b3(): return Value("B3")
def b2(): return Value("B2")
def b1(): return Value("B1")
def e2(): return Value("E2")
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])
def c2(): return Value("C2")
def green(): return Value("Green", uid=2)
def c3(): return Value("C3")
def bird(): return Value("Bird", uid=4)
def d1(): return Value("D1")
def dog(): return Value("Dog", uid=6)
def d2(): return Value("D2")
def medium(): return Value("Medium", uid=8)
def d3(): return Value("D3")
def seventies(): return Value("70s", uid=10)
def d4(): return Value("D4")
def twenties(): return Value("20s", uid=12)
def e1(): return Value("E1")