Ejemplo n.º 1
0
def test_write_roadway_project_card_from_logfile(request, logfilename):
    print("\n--Starting:", request.node.name)

    test_project = Project.create_project(roadway_log_file=logfilename,
                                          base_roadway_dir=BASE_ROADWAY_DIR)
    test_project.write_project_card(
        os.path.join(SCRATCH_DIR, "t_roadway_pc_test.yml"))
Ejemplo n.º 2
0
def test_write_transit_project_card_route_shape(request):
    print("\n--Starting:", request.node.name)

    test_project = Project.create_project(
        base_transit_source=os.path.join(CUBE_DIR, "transit.LIN"),
        build_transit_source=os.path.join(CUBE_DIR,
                                          "transit_route_shape_change"),
    )
    test_project.write_project_card(
        os.path.join(SCRATCH_DIR, "t_transit_shape_test.yml"))
Ejemplo n.º 3
0
def test_logfile_read(request, logfilename):
    """
    Tests that the logfile can be read in and
    produces a DataFrame.
    """
    print("\n--Starting:", request.node.name)

    print("Reading: {}".format(logfilename))
    lf = Project.read_logfile(logfilename)
    assert type(lf) == DataFrame
Ejemplo n.º 4
0
def test_write_transit_project_card(request):
    print("\n--Starting:", request.node.name)
    test_lin_base = """
    ;;<<PT>><<LINE>>;;
    LINE NAME="0_452-111_452_pk1",
    MODE=5,
    HEADWAY[1]=10,
    NODES=
     39249,
     -39240,
     54648

    LINE NAME="0_134-111_134_pk1",
     LONGNAME="Ltd Stop - Highland - Cleveland - Cretin - Mpls",
     HEADWAY[1]=20,
     MODE=5,
     ONEWAY=T,
     OPERATOR=3,
    NODES=
     39249,
     -39240,
     54648,

    """
    test_lin_build = """
    ;;<<PT>><<LINE>>;;
    LINE NAME="0_452-111_452_pk1",
    MODE=5,
    HEADWAY[1]=15,
    HEADWAY[2]=10,
    NODES=
     39249,
     -39240,
     54648

     LINE NAME="0_134-111_134_pk0",
      LONGNAME="Ltd Stop - Highland - Cleveland - Cretin - Mpls",
      HEADWAY[1]=120,
      MODE=5,
      ONEWAY=T,
      OPERATOR=3,
     NODES=
      84250,
      92566,
      129190
    """
    test_project = Project.create_project(
        base_transit_source=test_lin_base,
        build_transit_source=test_lin_build,
        project_name="test suite small changes",
    )
    print("")
    test_project.write_project_card(
        os.path.join(SCRATCH_DIR, "t_transit_test.yml"))
Ejemplo n.º 5
0
def test_highway_change_project_card_valid(request, logfilename):
    print("\n--Starting:", request.node.name)

    print("Reading: {}".format(logfilename))
    lf = Project.read_logfile(logfilename)
    test_project = Project.create_project(roadway_log_file=logfilename,
                                          base_roadway_dir=ROADWAY_DIR)

    test_project.write_project_card(
        os.path.join(
            SCRATCH_DIR,
            "t_" + os.path.splitext(os.path.basename(logfilename))[0] + ".yml",
        ))

    from network_wrangler import ProjectCard

    valid = ProjectCard.validate_project_card_schema(
        os.path.join(
            SCRATCH_DIR,
            "t_" + os.path.splitext(os.path.basename(logfilename))[0] + ".yml",
        ))

    assert valid == True
Ejemplo n.º 6
0
def test_highway_project_card(request, logfilename):
    """
    Tests that the logfile can be read in and
    produces a DataFrame.
    """
    print("\n--Starting:", request.node.name)

    print("Reading: {}".format(logfilename))
    lf = Project.read_logfile(logfilename)
    assert type(lf) == DataFrame

    test_project = Project.create_project(roadway_log_file=logfilename,
                                          base_roadway_dir=ROADWAY_DIR)

    assert type(test_project.roadway_changes) == DataFrame
    # assert(type(test_project.card_data)==Dict[str, Dict[str, Any]])
    assert type(test_project.card_data) == dict

    test_project.write_project_card(
        os.path.join(
            SCRATCH_DIR,
            "t_" + os.path.splitext(os.path.basename(logfilename))[0] + ".yml",
        ))