-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #44 from Deltares-research/feature/varying-updates
Feature/varying updates
- Loading branch information
Showing
2 changed files
with
263 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import networkx as nx | ||
import shapely | ||
|
||
import pytest | ||
|
||
import dtv_backend.fis | ||
|
||
|
||
@pytest.fixture | ||
def FG(): | ||
FG = nx.read_gpickle('../notebooks/fis-network/result/network_digital_twin_v0.3.pickle') | ||
for n, node in FG.nodes.items(): | ||
node['geometry'] = shapely.geometry.shape(node['geometry']) | ||
for e, edge in FG.edges.items(): | ||
edge['geometry'] = shapely.geometry.shape(edge['geometry']) | ||
return FG | ||
|
||
@pytest.fixture | ||
def nodes(): | ||
test_nodes = [ | ||
{"n": "8862371", "route_to_sea": False}, | ||
{"n": "8864002", "route_to_sea": True} | ||
] | ||
return test_nodes | ||
|
||
|
||
def test_route_to_sea(FG, nodes): | ||
for row in nodes: | ||
result = dtv_backend.fis.route_to_sea(row["n"], FG) | ||
assert row['route_to_sea'] == result, "route to sea expected: {row['route_to_sea']}, observed: {result}" |
Oops, something went wrong.