Skip to content

Commit

Permalink
Merge branch 'dev' into v0.7-prep
Browse files Browse the repository at this point in the history
  • Loading branch information
smmaurer committed Jul 25, 2023
2 parents ddcd908 + 0e82a24 commit 6cbaa3e
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 26 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
python-version: '3.10'
- name: Install Pandana
run: |
pip install .
Expand Down
9 changes: 5 additions & 4 deletions tests/test_osm.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,11 @@ def test_process_node():
assert osm.process_node(test_node) == expected


@skipifci
def test_network_from_bbox(bbox2):
net = osm.pdna_network_from_bbox(*bbox2)
assert isinstance(net, pandana.Network)
# This needs to be fixed in UrbanAccess
# @skipifci
# def test_network_from_bbox(bbox2):
# net = osm.pdna_network_from_bbox(*bbox2)
# assert isinstance(net, pandana.Network)


def test_build_node_query_no_tags(bbox1):
Expand Down
10 changes: 6 additions & 4 deletions tests/test_pandana.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import os.path

import numpy as np
from numpy.testing import assert_allclose
import pandas as pd
import pytest
from pandas.util import testing as pdt
from pandana.testing import skipifci

import pandana.network as pdna

from numpy.testing import assert_allclose
from pandas.testing import assert_index_equal

from pandana.testing import skipifci


@pytest.fixture(scope="module")
def sample_osm(request):
Expand Down Expand Up @@ -220,7 +222,7 @@ def test_assign_nodeids(sample_osm):
# check a couple of assignments for accuracy
assert node_ids1.loc[48] == 1840703798
assert node_ids1.loc[43] == 257739973
pdt.assert_index_equal(x.index, node_ids1.index)
assert_index_equal(x.index, node_ids1.index)

# test with max distance - this max distance is in decimal degrees
node_ids2 = sample_osm.get_node_ids(x, y, 0.0005)
Expand Down
35 changes: 18 additions & 17 deletions tests/test_pandash5.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@
import pandas as pd
import pytest

import pandas.util.testing as pdt
from pandana import Network
from pandana.testing import skipifci
from pandas.testing import assert_frame_equal
from pandas.testing import assert_series_equal

from pandana import Network
from pandana.loaders import pandash5 as ph5
from pandana.testing import skipifci


@pytest.fixture(scope='module')
Expand Down Expand Up @@ -92,8 +93,8 @@ def test_remove_nodes(network, rm_nodes):
index=[1, 4, 5, 7, 8])
exp_edges = exp_edges[['from', 'to', 'distance', 'time']] # order columns

pdt.assert_frame_equal(nodes, exp_nodes)
pdt.assert_frame_equal(edges, exp_edges)
assert_frame_equal(nodes, exp_nodes)
assert_frame_equal(edges, exp_edges)


@skipifci
Expand All @@ -103,10 +104,10 @@ def test_network_to_pandas_hdf5(

store = pd.HDFStore(tmpfile)

pdt.assert_frame_equal(store['nodes'], nodes)
pdt.assert_frame_equal(store['edges'], edges_df)
pdt.assert_series_equal(store['two_way'], pd.Series([two_way]))
pdt.assert_series_equal(
assert_frame_equal(store['nodes'], nodes)
assert_frame_equal(store['edges'], edges_df)
assert_series_equal(store['two_way'], pd.Series([two_way]))
assert_series_equal(
store['impedance_names'], pd.Series(impedance_names))


Expand All @@ -118,10 +119,10 @@ def test_network_to_pandas_hdf5_removal(

store = pd.HDFStore(tmpfile)

pdt.assert_frame_equal(store['nodes'], nodes)
pdt.assert_frame_equal(store['edges'], edges)
pdt.assert_series_equal(store['two_way'], pd.Series([two_way]))
pdt.assert_series_equal(
assert_frame_equal(store['nodes'], nodes)
assert_frame_equal(store['edges'], edges)
assert_series_equal(store['two_way'], pd.Series([two_way]))
assert_series_equal(
store['impedance_names'], pd.Series(impedance_names))


Expand All @@ -131,8 +132,8 @@ def test_network_from_pandas_hdf5(
ph5.network_to_pandas_hdf5(network, tmpfile)
new_net = ph5.network_from_pandas_hdf5(Network, tmpfile)

pdt.assert_frame_equal(new_net.nodes_df, nodes)
pdt.assert_frame_equal(new_net.edges_df, edges_df)
assert_frame_equal(new_net.nodes_df, nodes)
assert_frame_equal(new_net.edges_df, edges_df)
assert new_net._twoway == two_way
assert new_net.impedance_names == impedance_names

Expand All @@ -145,8 +146,8 @@ def test_network_save_load_hdf5(

nodes, edges = ph5.remove_nodes(network, rm_nodes)

pdt.assert_frame_equal(new_net.nodes_df, nodes)
pdt.assert_frame_equal(new_net.edges_df, edges)
assert_frame_equal(new_net.nodes_df, nodes)
assert_frame_equal(new_net.edges_df, edges)
assert new_net._twoway == two_way
assert new_net.impedance_names == impedance_names

Expand Down

0 comments on commit 6cbaa3e

Please sign in to comment.