-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add benchmark tests and post PR comments c.t. base
- lints
- Loading branch information
Showing
18 changed files
with
102 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,6 +22,7 @@ | |
|
||
class ShapeAddError(Exception): | ||
"""Raised when there is an issue with adding shapes.""" | ||
|
||
pass | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,98 @@ | ||
"""Benchmark tests for the project.""" | ||
|
||
from network_wrangler.roadway import load_roadway_from_dir, write_roadway | ||
from network_wrangler.transit import load_transit, write_transit | ||
from projectcard import read_cards | ||
|
||
|
||
def test_roadway_io(stpaul_ex_dir, test_out_dir): | ||
def roadway_io(stpaul_ex_dir, test_out_dir): | ||
net = load_roadway_from_dir(stpaul_ex_dir) | ||
write_roadway(net, out_dir=test_out_dir, prefix="stpaul", file_format="geojson") | ||
write_roadway(net, test_out_dir, prefix="stpaul", file_format="geojson") | ||
|
||
|
||
def test_roadway_io(benchmark, stpaul_ex_dir, test_out_dir): | ||
benchmark(roadway_io, stpaul_ex_dir, test_out_dir) | ||
|
||
def test_roadway_property_change(stpaul_ex_dir): | ||
|
||
def roadway_property_change(stpaul_ex_dir): | ||
net = load_roadway_from_dir(stpaul_ex_dir) | ||
c = stpaul_ex_dir / "project_cards" / "road.prop_change.multiple.yml" | ||
p = read_cards(c) | ||
for p in p.values(): | ||
net.apply(p) | ||
|
||
|
||
def test_roadway_managed_lane_model_net(stpaul_ex_dir, test_out_dir): | ||
def test_roadway_property_change(benchmark, stpaul_ex_dir): | ||
benchmark(roadway_property_change, stpaul_ex_dir) | ||
|
||
|
||
def roadway_model_net(stpaul_ex_dir, test_out_dir): | ||
net = load_roadway_from_dir(stpaul_ex_dir) | ||
c = stpaul_ex_dir / "project_cards" / "road.managed_lanes.restricted_access.yml" | ||
p = read_cards(c) | ||
for p in p.values(): | ||
net.apply(p) | ||
card_dict = read_cards(c) | ||
for p in card_dict.values(): | ||
net = net.apply(p) | ||
net.model_net.write(test_out_dir / "stpaul_managed_lane_model_net") | ||
|
||
|
||
def test_roadway_many_projects_io(stpaul_ex_dir): | ||
def test_roadway_managed_lane_model_net(benchmark, stpaul_ex_dir, test_out_dir): | ||
benchmark(roadway_model_net, stpaul_ex_dir, test_out_dir) | ||
|
||
|
||
def apply_many_road_projects(stpaul_ex_dir): | ||
net = load_roadway_from_dir(stpaul_ex_dir) | ||
projects = [ | ||
"road.divide_facility.yml", | ||
"road.prop_change.multiple.yml" | ||
] | ||
projects = ["road.divide_facility.yml", "road.prop_change.multiple.yml"] | ||
c = [stpaul_ex_dir / "project_cards" / p for p in projects] | ||
p = read_cards(c) | ||
for p in p.values(): | ||
card_dict = read_cards(c) | ||
for p in card_dict.values(): | ||
net.apply(p) | ||
|
||
|
||
def test_transit_io(stpaul_ex_dir, test_out_dir): | ||
def test_roadway_many_projects_io(benchmark, stpaul_ex_dir): | ||
benchmark(apply_many_road_projects, stpaul_ex_dir) | ||
|
||
|
||
def transit_io(stpaul_ex_dir, test_out_dir): | ||
net = load_transit(stpaul_ex_dir) | ||
write_transit(net, test_out_dir) | ||
|
||
|
||
def test_transit_property_change(stpaul_ex_dir): | ||
def test_transit_io(benchmark, stpaul_ex_dir, test_out_dir): | ||
benchmark(transit_io, stpaul_ex_dir, test_out_dir) | ||
|
||
|
||
def apply_transit_property_change(stpaul_ex_dir): | ||
net = load_transit(stpaul_ex_dir) | ||
c = stpaul_ex_dir / "project_cards" / "transit.prop_change.route_time.yml" | ||
p = read_cards(c) | ||
for p in p.values(): | ||
card_dict = read_cards(c) | ||
for p in card_dict.values(): | ||
net.apply(p) | ||
|
||
|
||
def test_multiple_transit_property_change(stpaul_ex_dir): | ||
def test_transit_property_change(benchmark, stpaul_ex_dir): | ||
benchmark(apply_transit_property_change, stpaul_ex_dir) | ||
|
||
|
||
def apply_multiple_transit_projects(stpaul_ex_dir): | ||
net = load_transit(stpaul_ex_dir) | ||
projects = [ | ||
"transit.prop_change.route_time.yml", | ||
"transit.prop_change.multiple_trip_time.yml" | ||
] | ||
projects = ["transit.prop_change.route_time.yml", "transit.prop_change.multiple_trip_time.yml"] | ||
c = [stpaul_ex_dir / "project_cards" / p for p in projects] | ||
p = read_cards(c) | ||
for p in p.values(): | ||
cards_dict = read_cards(c) | ||
for p in cards_dict.values(): | ||
net.apply(p) | ||
|
||
|
||
def test_transit_routing_change(stpaul_ex_dir): | ||
def test_multiple_transit_property_change(benchmark, stpaul_ex_dir): | ||
benchmark(apply_multiple_transit_projects, stpaul_ex_dir) | ||
|
||
|
||
def apply_transit_routing_change(stpaul_ex_dir): | ||
road_net = load_roadway_from_dir(stpaul_ex_dir) | ||
net = load_transit(stpaul_ex_dir) | ||
net.road_net = road_net | ||
c = stpaul_ex_dir / "project_cards" / "transit.routing_change.yml" | ||
p = read_cards(c) | ||
for p in p.values(): | ||
net.apply(p) | ||
|
||
|
||
def test_transit_routing_change(benchmark, stpaul_ex_dir): | ||
benchmark(apply_transit_routing_change, stpaul_ex_dir) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.