Skip to content

Commit

Permalink
Fix test 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Saelyos committed Feb 27, 2024
1 parent 9e04c82 commit 1e86b24
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion roseau/load_flow/tests/test_electrical_network.py
Original file line number Diff line number Diff line change
Expand Up @@ -1827,6 +1827,6 @@ def test_propagate_potentials_center_transformers():
PotentialRef(id="pref2", element=bus2)
Transformer(id="transfo", bus1=bus1, bus2=bus2, parameters=tp)
en = ElectricalNetwork.from_element(bus2)
with contextlib.suppress(RoseauLoadFlowException): # No valid license
with contextlib.suppress(TypeError): # cython solve_load_flow method has been patched
en.solve_load_flow() # propagate the potentials
npt.assert_allclose(bus2.potentials.m_as("V"), np.array([200, -200, 0], dtype=np.complex128))
8 changes: 4 additions & 4 deletions roseau/load_flow/tests/test_solvers.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,22 +55,22 @@ def test_network_solver():
PotentialRef(id="pref", element=bus)
en = ElectricalNetwork.from_element(bus)

with contextlib.suppress(TypeError): # solve_load_flow method has been patched
with contextlib.suppress(TypeError): # cython solve_load_flow method has been patched
en.solve_load_flow()
solver = en._solver
assert isinstance(solver, NewtonGoldstein)

with contextlib.suppress(TypeError): # solve_load_flow method has been patched
with contextlib.suppress(TypeError): # cython solve_load_flow method has been patched
en.solve_load_flow(solver="newton_goldstein", solver_params={"m1": 0.2})
assert solver == en._solver # Solver did not change
assert solver.m1 == 0.2
assert solver.m2 == NewtonGoldstein.DEFAULT_M2

with contextlib.suppress(TypeError): # solve_load_flow method has been patched
with contextlib.suppress(TypeError): # cython solve_load_flow method has been patched
en.solve_load_flow(solver="newton")
assert solver != en._solver
assert isinstance(en._solver, Newton)

with contextlib.suppress(TypeError): # solve_load_flow method has been patched
with contextlib.suppress(TypeError): # cython solve_load_flow method has been patched
en.solve_load_flow() # Reset to default
assert isinstance(en._solver, NewtonGoldstein)

0 comments on commit 1e86b24

Please sign in to comment.