diff --git a/tests/test_energy_system.py b/tests/test_energy_system.py index e016d4b..473b0a5 100644 --- a/tests/test_energy_system.py +++ b/tests/test_energy_system.py @@ -15,24 +15,24 @@ import pytest -from oemof.network import energy_system as es +from oemof.network.energy_system import EnergySystem from oemof.network.network import Edge from oemof.network.network.nodes import Node def test_ensys_init(): node = Node("label") - ensys = es.EnergySystem(nodes=[node]) + ensys = EnergySystem(nodes=[node]) assert node in ensys.nodes with pytest.warns(FutureWarning): - ensys = es.EnergySystem(entities=[node]) + ensys = EnergySystem(entities=[node]) assert node in ensys.nodes class TestsEnergySystem: def setup_method(self): - self.es = es.EnergySystem() + self.es = EnergySystem() def test_add_nodes(self): assert not self.es.nodes @@ -54,14 +54,6 @@ def test_add_nodes(self): assert node2 in self.es.nodes assert (node1, node2) in self.es.flows().keys() - def test_node_access_warning(self): - node_label = "label" - self.es.add(Node(node_label)) - with pytest.warns( - match="API to access nodes by label is experimental" - ): - _ = es.node[node_label] - def test_add_flow_assignment(self): assert not self.es.nodes @@ -99,7 +91,7 @@ def subscriber(sender, **kwargs): subscriber.called = False - es.EnergySystem.signals[es.EnergySystem.add].connect( + EnergySystem.signals[EnergySystem.add].connect( subscriber, sender=node ) self.es.add(node) diff --git a/tests/test_network_classes.py b/tests/test_network_classes.py index 3dba933..9affbfb 100644 --- a/tests/test_network_classes.py +++ b/tests/test_network_classes.py @@ -19,7 +19,7 @@ import pytest -from oemof.network.energy_system import EnergySystem as EnSys +from oemof.network.energy_system import EnergySystem from oemof.network.network import Bus from oemof.network.network import Sink from oemof.network.network import Source @@ -31,7 +31,7 @@ class TestsNode: def setup_method(self): - self.energysystem = EnSys() + self.energysystem = EnergySystem() def test_entity_initialisation(self): entity = Entity(label="foo") @@ -328,7 +328,7 @@ def test_flow_setter(self): class TestsEnergySystemNodesIntegration: def setup_method(self): - self.es = EnSys() + self.es = EnergySystem() def test_entity_registration(self): n1 = Node(label="") @@ -339,7 +339,10 @@ def test_entity_registration(self): assert self.es.node[""] == n2 n3 = Node(label="", inputs=[n1], outputs=[n2]) self.es.add(n3) - assert self.es.node[""] == n3 + with pytest.warns( + match="API to access nodes by label is experimental" + ): + assert self.es.node[""] == n3 def test_deprecated_classes():