Ejemplo n.º 1
0
def test_is_valuation():
    """Test is_valuation function."""
    color = Attribute("color", ['R', 'G', 'B'])
    size = Attribute("size", ['S', 'M', 'L'])
    a = AttributeStructure(color, size)
    o = ['s1', 's2']
    asys = AttributeSystem(a, o)

    ascr = {
        ('color', 's1'): ['R'],
        ('color', 's2'): ['B', 'G'],
        ('size', 's1'): ['M'],
        ('size', 's2'): ['L', 'S']}

    s = State(asys, ascr)

    assert not s.is_valuation('color')
    assert not s.is_valuation('size')
    s.set_ascription(('color', 's2'), ['B'])
    assert s.is_valuation('color')
    s.set_ascription(('size', 's2'), ['L'])
    assert s.is_valuation('size')
Ejemplo n.º 2
0
def test_is_valuation():
    """Test is_valuation function."""
    color = Attribute("color", ['R', 'G', 'B'])
    size = Attribute("size", ['S', 'M', 'L'])
    a = AttributeStructure(color, size)
    o = ['s1', 's2']
    asys = AttributeSystem(a, o)

    ascr = {
        ('color', 's1'): ['R'],
        ('color', 's2'): ['B', 'G'],
        ('size', 's1'): ['M'],
        ('size', 's2'): ['L', 'S']
    }

    s = State(asys, ascr)

    assert not s.is_valuation('color')
    assert not s.is_valuation('size')
    s.set_ascription(('color', 's2'), ['B'])
    assert s.is_valuation('color')
    s.set_ascription(('size', 's2'), ['L'])
    assert s.is_valuation('size')