Exemple #1
0
def test_object_find(handle):
    rg_index = solver.project_get_index(shared_enum.ObjectType.GAGE, 'RG1')
    sub_index_0 = solver.project_get_index(shared_enum.ObjectType.SUBCATCH, '2')
    sub_index_1 = solver.project_get_index(shared_enum.ObjectType.SUBCATCH, '3')
    node_index = solver.project_get_index(shared_enum.ObjectType.NODE, '24')
    link_index = solver.project_get_index(shared_enum.ObjectType.LINK, '16')
    assert rg_index == 0
    assert sub_index_0 == 0
    assert sub_index_1 == 1
    assert node_index == 12
    assert link_index == 12
Exemple #2
0
def test_object_get_index(handle):
    with pytest.raises(Exception) as exc_info:
        node_index = solver.project_get_index(shared_enum.ObjectType.NODE, '6')
        sub_index = solver.project_get_index(shared_enum.ObjectType.SUBCATCH, '20')

#    assert node_index == -1
#    assert sub_index == -1

    node_index = solver.project_get_index(shared_enum.ObjectType.NODE, '20')
    sub_index = solver.project_get_index(shared_enum.ObjectType.SUBCATCH, '6')

    assert node_index == 8
    assert sub_index == 5
Exemple #3
0
def test_outfall_stats(before_end):
    id = '18'

    index = solver.project_get_index(shared_enum.ObjectType.NODE, id)

    stats = solver.outfall_get_stats(index)
    assert stats.totalLoad != None
Exemple #4
0
def test_lid_group_get_result(run_lid_sim):
    index = solver.project_get_index(shared_enum.ObjectType.SUBCATCH, 'wBC')
    while True:
        time = solver.swmm_step()
        if time == 0:
            break

    result = solver.lid_group_get_result(index, shared_enum.LidResult.OLD_DRAIN_FLOW)
Exemple #5
0
def test_pump_get_stats(run_sim):
    index = solver.project_get_index(shared_enum.ObjectType.LINK, 'P1')
    while True:
        time = solver.swmm_step()
        if time == 0:
            break

    stats = solver.pump_get_stats(index)
Exemple #6
0
def test_storage_get_stats(before_end):
    node_index = solver.project_get_index(shared_enum.ObjectType.NODE, 'SU1')
    while True:
        time = solver.swmm_step()
        if time == 0:
            break

    stor_stats = solver.storage_get_stats(node_index)
    assert stor_stats.avgVol == pytest.approx(0, 0.1)
Exemple #7
0
def test_node_get_type(handle):
    node_type = solver.node_get_type(8)
    assert node_type == shared_enum.NodeType.JUNCTION
    node_index = solver.project_get_index(shared_enum.ObjectType.NODE, '18')
    node_type = solver.node_get_type(node_index)
    assert node_type == shared_enum.NodeType.OUTFALL
Exemple #8
0
def test_error_message_handling(handle):
    with pytest.raises(Exception) as exc_info:
        solver.project_get_index(shared_enum.ObjectType.SUBCATCH, 'sloth')

    assert 'API Key Error: Object index out of Bounds' in str(exc_info.value)