Esempio n. 1
0
def test_equalfield():
    """py.test for equalfield"""
    thedata = (
        ("BUILDING", 0, 1, 'Name', 7, True),
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 2, 'Name', 7, False),
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 1, 'Terrain', 7, True),
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 1, 'Terrain', 7, True),
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 1, 'North_Axis', 7, True),
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 2, 'North_Axis', 2, True),
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 3, 'Maximum_Number_of_Warmup_Days', 7, True),
        ("BUILDING", 0, 3, 'Minimum_Number_of_Warmup_Days', 7, False),
        # key, objindex1, objeindex2, fieldname, places, isequal
    )
    for key, objindex1, objindex2, fieldname, places, isequal in thedata:
        idfobject1 = bunchdt[key][objindex1]
        idfobject2 = bunchdt[key][objindex2]
        result = modeleditor.equalfield(bunchdt, data, commdct, idfobject1,
                                        idfobject2, fieldname, places)
        assert result == isequal
    (key, objindex1, objeindex2, fieldname, places,
     isequal) = ("BUILDING", 0, 1, 'Name', 7, True)
    idfobject1 = bunchdt[key][objindex1]
    idfobject2 = bunchdt["ZONE"][objindex2]
    with pytest.raises(modeleditor.NotSameObjectError):
        modeleditor.equalfield(bunchdt, data, commdct, idfobject1, idfobject2,
                               fieldname, places)
Esempio n. 2
0
def test_equalfield():
    """py.test for equalfield"""
    thedata = (
        ("BUILDING", 0, 1, 'Name', 7, True), 
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 2, 'Name', 7, False), 
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 1, 'Terrain', 7, True), 
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 1, 'Terrain', 7, True), 
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 1, 'North_Axis', 7, True), 
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 2, 'North_Axis', 2, True), 
        # key, objindex1, objeindex2, fieldname, places, isequal
        ("BUILDING", 0, 3, 'Maximum_Number_of_Warmup_Days', 7, True), 
        ("BUILDING", 0, 3, 'Minimum_Number_of_Warmup_Days', 7, False), 
        # key, objindex1, objeindex2, fieldname, places, isequal
    )
    for key, objindex1, objindex2, fieldname, places, isequal in thedata:
        idfobject1 = bunchdt[key][objindex1]
        idfobject2 = bunchdt[key][objindex2]
        result = modeleditor.equalfield(bunchdt, data, commdct, 
            idfobject1, idfobject2, fieldname, places)
        assert result == isequal
    (key, objindex1, objeindex2, 
        fieldname, places, isequal) = ("BUILDING", 0, 1, 'Name', 7, True)
    idfobject1 = bunchdt[key][objindex1]
    idfobject2 = bunchdt["ZONE"][objindex2]
    with pytest.raises(modeleditor.NotSameObjectError):
        modeleditor.equalfield(bunchdt, data, commdct, 
            idfobject1, idfobject2, fieldname, places)