22import pandas as pd
33import pytest
44
5- from linopy .constants import Result , Solution , Status
5+ from linopy .constants import (
6+ Result ,
7+ Solution ,
8+ SolverStatus ,
9+ Status ,
10+ TerminationCondition ,
11+ )
612from linopy .model import Model
713from linopy .scaling import ScaleOptions , ScalingContext , resolve_options
814
@@ -157,10 +163,12 @@ def test_unscale_solution_none_solution() -> None:
157163 ctx = ScalingContext .from_model (m .matrices , opts )
158164
159165 # Result with None solution returns unchanged
160- result = Result (Status ("warning" , "infeasible" ), solution = None )
166+ result = Result (
167+ Status (SolverStatus .warning , TerminationCondition .infeasible ), solution = None
168+ )
161169 unscaled = ctx .unscale_solution (result )
162170 assert unscaled is result
163- assert unscaled .solution is None
171+ assert unscaled is not None and unscaled .solution is None
164172
165173
166174def test_unscale_solution_empty_primal_dual () -> None :
@@ -170,8 +178,8 @@ def test_unscale_solution_empty_primal_dual() -> None:
170178
171179 # Empty primal/dual should not fail
172180 sol = Solution (primal = pd .Series (dtype = float ), dual = pd .Series (dtype = float ))
173- result = Result (Status ("ok" , " optimal" ), solution = sol )
181+ result = Result (Status (SolverStatus . ok , TerminationCondition . optimal ), solution = sol )
174182 unscaled = ctx .unscale_solution (result )
175- assert unscaled .solution is not None
183+ assert unscaled is not None and unscaled .solution is not None
176184 assert unscaled .solution .primal .empty
177185 assert unscaled .solution .dual .empty
0 commit comments