From 09cef5249fb12f915f75bde0b40c6085adeae2c6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Pedro=20L=2E=20Magalh=C3=A3es?= <pmlpm@posteo.de>
Date: Thu, 15 Aug 2024 00:58:36 +0200
Subject: [PATCH] Revised the method to reset node types.

---
 src/topupopt/problems/esipp/network.py | 5 ++++-
 tests/test_dhn_utils.py                | 1 -
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/topupopt/problems/esipp/network.py b/src/topupopt/problems/esipp/network.py
index 91dbf5c..be2f17a 100644
--- a/src/topupopt/problems/esipp/network.py
+++ b/src/topupopt/problems/esipp/network.py
@@ -752,9 +752,12 @@ class Network(nx.MultiDiGraph):
         elif self.is_source_sink_node(node_key):
             # source/sink node
             self.source_sink_nodes.remove(node_key)
-        else: # self.is_waypoint_node(node_key):
+        elif self.is_waypoint_node(node_key):
             # has to be a waypoint node
             self.waypoint_nodes.remove(node_key)
+        # No need to reset node but this could mean something is up
+        # else:
+        #     raise ValueError('Unknown node type.')
 
     # *************************************************************************
     # *************************************************************************
diff --git a/tests/test_dhn_utils.py b/tests/test_dhn_utils.py
index 0ad992e..e5be17c 100644
--- a/tests/test_dhn_utils.py
+++ b/tests/test_dhn_utils.py
@@ -20,7 +20,6 @@ from topupheat.common.fluids import FluidDatabase  # , Fluid
 # *****************************************************************************
 # *****************************************************************************
 
-
 class TestDistrictHeatingNetworkUtils:
     # *************************************************************************
     # *************************************************************************
-- 
GitLab