Skip to content

Commit

Permalink
Correction of the tests
Browse files Browse the repository at this point in the history
  • Loading branch information
benoit9126 committed Sep 19, 2023
1 parent 9a8d6cc commit e6a2115
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion roseau/load_flow/models/loads/flexible_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ def constant(cls) -> Self:
return cls(
control_p=cls._control_class.constant(),
control_q=cls._control_class.constant(),
projection=cls._projection_class(type=cls._projection_class.DEFAULT_TYPE),
projection=cls._projection_class(type=cls._projection_class._DEFAULT_TYPE),
s_max=1.0,
)

Expand Down
5 changes: 3 additions & 2 deletions roseau/load_flow/models/tests/test_flexible_parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -234,10 +234,11 @@ def flexible_parameter(control_p, control_q, projection):


@pytest.fixture()
def monkeypatch_flexible_parameter_compute_powers(rg):
def monkeypatch_flexible_parameter_compute_powers(monkeypatch, rg):
@contextmanager
def inner():
with pytest.MonkeyPatch.context() as m:
nonlocal monkeypatch
with monkeypatch.context() as m:
m.setattr(target=ElectricalNetwork, name="solve_load_flow", value=lambda *args, **kwargs: 2)
m.setattr(
target=PowerLoad,
Expand Down
2 changes: 1 addition & 1 deletion roseau/load_flow/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -661,7 +661,7 @@ def res_branches(self) -> pd.DataFrame:
"potential2": complex,
}
)
.groupby(["branch_id", "phase"]) # aggregate x1 and x2 for the same phase
.groupby(["branch_id", "phase"], observed=False) # aggregate x1 and x2 for the same phase
.mean() # 2 values; only one is not nan -> keep it
.dropna(how="all") # if all values are nan -> drop the row (the phase does not exist)
)
Expand Down

0 comments on commit e6a2115

Please sign in to comment.