Skip to content

Commit

Permalink
add a test that looks at repeated calls to nearest_pois
Browse files Browse the repository at this point in the history
this is in relation to

#73
  • Loading branch information
fscottfoti committed May 10, 2017
1 parent 1af1709 commit 0a709e1
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions pandana/tests/test_pandana.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,31 @@ def test_plot(sample_osm):
sample_osm.plot(s)


def test_repeat_pois(sample_osm):
net = sample_osm

# this test is inspired by this issue
# https://github.com/UDST/pandana/issues/73

ssize = 100000
x, y = random_x_y(sample_osm, ssize)
x2, y2 = random_x_y(sample_osm, ssize)

# set two categories
net.init_pois(num_categories=2, max_dist=2000, max_pois=10)
net.set_pois("restaurants", x, y)
net.set_pois("parks", x2, y2)

# fetch the first
s1 = net.nearest_pois(2000, "restaurants", num_pois=10)
# the second
s2 = net.nearest_pois(2000, "parks", num_pois=10)
# and the first again
s3 = net.nearest_pois(2000, "restaurants", num_pois=10)

assert s1.equals(s3)


def test_pois(sample_osm):
net = sample_osm

Expand Down

0 comments on commit 0a709e1

Please sign in to comment.