# Path: urbanaccess/network.py
# class urbanaccess_network(object):
#     def __init__(self,
#                  transit_nodes=pd.DataFrame(),
#                  transit_edges=pd.DataFrame(),
#                  net_connector_edges=pd.DataFrame(),
#                  osm_nodes=pd.DataFrame(),
#                  osm_edges=pd.DataFrame(),
#                  net_nodes=pd.DataFrame(),
#                  net_edges=pd.DataFrame()):
# def _nearest_neighbor(df1, df2):
# def integrate_network(urbanaccess_network, headways=False,
#                       urbanaccess_gtfsfeeds_df=None, headway_statistic='mean'):
# def _add_headway_impedance(ped_to_transit_edges_df, headways_df,
#                            headway_statistic='mean'):
# def _route_id_to_node(stops_df, edges_w_routes):
# def _connector_edges(osm_nodes, transit_nodes, travel_speed_mph=3):
# def _format_pandana_edges_nodes(edge_df, node_df):
# def save_network(urbanaccess_network, filename,
#                  dir=config.settings.data_folder,
#                  overwrite_key=False, overwrite_hdf5=False):
# def load_network(dir=config.settings.data_folder, filename=None):


import pytest
import pandas as pd
from urbanaccess import network


@pytest.fixture
def osm_nodes_df():
    data = {
        'id': (1, 2, 3),
        'x': [-122.267546, -122.264479, -122.219119],
        'y': [37.802919, 37.808042, 37.782288]
    }
    osm_nodes = pd.DataFrame(data).set_index('id')
    return osm_nodes


@pytest.fixture
def transit_nodes_df():
    data = {
        'node_id_route': ['1_transit_a', '2_transit_a',
                          '3_transit_a', '4_transit_a'],
        'x': [-122.265417, -122.266910, -122.269741, -122.238638],
        'y': [37.806372, 37.802687, 37.799480, 37.797234]
    }
    transit_nodes = pd.DataFrame(data).set_index('node_id_route')
    return transit_nodes


@pytest.fixture
def expected_transit_nodes_neighbor_df(transit_nodes_df):
    data = {'node_id_route': ['1_transit_a', '2_transit_a',
                              '3_transit_a', '4_transit_a'],

# Path: urbanaccess/network.py
# class urbanaccess_network(object):
#     def __init__(self,
#                  transit_nodes=pd.DataFrame(),
#                  transit_edges=pd.DataFrame(),
#                  net_connector_edges=pd.DataFrame(),
#                  osm_nodes=pd.DataFrame(),
#                  osm_edges=pd.DataFrame(),
#                  net_nodes=pd.DataFrame(),
#                  net_edges=pd.DataFrame()):
# def _nearest_neighbor(df1, df2):
# def integrate_network(urbanaccess_network, headways=False,
#                       urbanaccess_gtfsfeeds_df=None, headway_statistic='mean'):
# def _add_headway_impedance(ped_to_transit_edges_df, headways_df,
#                            headway_statistic='mean'):
# def _route_id_to_node(stops_df, edges_w_routes):
# def _connector_edges(osm_nodes, transit_nodes, travel_speed_mph=3):
# def _format_pandana_edges_nodes(edge_df, node_df):
# def save_network(urbanaccess_network, filename,
#                  dir=config.settings.data_folder,
#                  overwrite_key=False, overwrite_hdf5=False):
# def load_network(dir=config.settings.data_folder, filename=None):


# Path: urbanaccess/tests/test_network.py
import pytest
import pandas as pd
from urbanaccess import network



@pytest.fixture
def osm_nodes_df():
    data = {
        'id': (1, 2, 3),
        'x': [-122.267546, -122.264479, -122.219119],
        'y': [37.802919, 37.808042, 37.782288]
    }
    osm_nodes = pd.DataFrame(data).set_index('id')
    return osm_nodes


@pytest.fixture
def transit_nodes_df():
    data = {
        'node_id_route': ['1_transit_a', '2_transit_a',
                          '3_transit_a', '4_transit_a'],
        'x': [-122.265417, -122.266910, -122.269741, -122.238638],
        'y': [37.806372, 37.802687, 37.799480, 37.797234]
    }
    transit_nodes = pd.DataFrame(data).set_index('node_id_route')
    return transit_nodes


@pytest.fixture
def expected_transit_nodes_neighbor_df(transit_nodes_df):
    data = {'node_id_route': ['1_transit_a', '2_transit_a',
                              '3_transit_a', '4_transit_a'],

            'nearest_osm_node': [2, 1, 1, 3]}