Skip to content

Commit

Permalink
Merge pull request #44 from Deltares-research/feature/varying-updates
Browse files Browse the repository at this point in the history
Feature/varying updates
  • Loading branch information
Fedor Baart authored Mar 20, 2024
2 parents 5c7121d + fbb5e4a commit 5e4520a
Show file tree
Hide file tree
Showing 2 changed files with 263 additions and 0 deletions.
30 changes: 30 additions & 0 deletions dtv_backend/tests/test_route.py
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}"
Loading

0 comments on commit 5e4520a

Please sign in to comment.