Example #1
0
def check_coproductdp_error1():

    # check error if types are different
    F1 = parse_poset('g')
    F2 = parse_poset('kg')
    R1 = parse_poset('J')
    R2 = parse_poset('V')
    # Same R, different F
    dp1 = Template(F1, R1)
    dp2 = Template(F2, R1)
    try:
        CoProductDP((dp1, dp2))
    except ValueError as e:
        assert 'Cannot form' in str(e)
    else:
        raise Exception()

    # Same F, different R
    dp1 = Template(F1, R1)
    dp2 = Template(F1, R2)
    try:
        CoProductDP((dp1, dp2))
    except ValueError as e:
        assert 'Cannot form' in str(e)
    else:
        raise Exception()
Example #2
0
def test_series_invalid():
    """ invalid argument for Series """
    F1 = parse_poset('s')
    R1 = parse_poset('s')
    F2 = parse_poset('m')
    R2 = parse_poset('g')
    dp1 = Template(F1, R1)
    dp2 = Template(F2, R2)
    assert_raises(DPInternalError, Series, dp1, dp2)
Example #3
0
def DPLoop2_1():
    F1 = parse_poset('N')
    R1 = parse_poset('J')
    F2 = parse_poset('m')
    R2 = F2
    F = PosetProduct((F1, F2))
    R = PosetProduct((R1, R2))
    dp = Template(F, R)
    return DPLoop2(dp)
Example #4
0
def test_exc_connect_resources_to_outside():
    F1 = parse_poset('s')
    R1 = parse_poset('s')
    dp = Template(F1, R1)
    ndp = dpwrap(dp, 'f1', 'r1')
    ndp_name = 'name'
    name2ndp = {ndp_name: ndp}
    connections = []
    rnames = ['r1', 'notpresent']

    assert_raises(ValueError, connect_resources_to_outside, name2ndp,
                  connections, ndp_name, rnames)
Example #5
0
def LabelerDP1():
    F = parse_poset('m')
    R = parse_poset('g')
    dp0 = Template(F, R)
    dp = LabelerDP(dp0, ('name', 'name2'))
    return dp
Example #6
0
def Template_1():
    P = parse_poset('m')
    F = P
    R = PosetProduct((P, P))
    return Template(F, R)