Skip to content

Commit

Permalink
Improve readability of path_router test: using yied
Browse files Browse the repository at this point in the history
  • Loading branch information
justinefricou committed Jul 23, 2024
1 parent 52e3e9c commit c96d36f
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions geotrek/core/tests/test_path_router.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,16 @@ def test_python_graph_from_path(self):

def gen_random_point():
"""Return unique (non-conflicting) point"""
return ((0., x + 1.) for x in range(10, 100))
for x in range(10, 100):
yield (0., x + 1.)

r_point = gen_random_point().__next__
r_point_gen = gen_random_point()

e_1_2 = PathFactory(geom=LineString(p_1_1, r_point(), p_2_2))
e_2_3 = PathFactory(geom=LineString(p_2_2, r_point(), p_3_3))
e_1_2 = PathFactory(geom=LineString(p_1_1, next(r_point_gen), p_2_2))
e_2_3 = PathFactory(geom=LineString(p_2_2, next(r_point_gen), p_3_3))

# Non connex
e_4_5 = PathFactory(geom=LineString(p_4_4, r_point(), p_5_5))
e_4_5 = PathFactory(geom=LineString(p_4_4, next(r_point_gen), p_5_5))

graph = {
'nodes': {
Expand Down

0 comments on commit c96d36f

Please sign in to comment.