Coverage for sparkle/types/status.py: 94%

17 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-07-01 13:21 +0000

1"""Class for solver status.""" 

2from __future__ import annotations 

3from enum import Enum 

4 

5 

6class SolverStatus(str, Enum): 

7 """Possible return states for solver runs.""" 

8 SUCCESS = "SUCCESS" # Positive status 

9 SAT = "SAT" # SAT specific positive status 

10 UNSAT = "UNSAT" # SAT specific positive status 

11 

12 # Negative status 

13 UNKNOWN = "UNKNOWN" 

14 CRASHED = "CRASHED" 

15 TIMEOUT = "TIMEOUT" 

16 WRONG = "WRONG" 

17 ERROR = "ERROR" 

18 KILLED = "KILLED" 

19 

20 def __str__(self: SolverStatus) -> str: 

21 """Return the string value of the SolverStatus.""" 

22 return str(self.value) 

23 

24 @property 

25 def positive(self: SolverStatus) -> bool: 

26 """Return whether the status is positive.""" 

27 return self in [SolverStatus.SUCCESS, SolverStatus.SAT, SolverStatus.UNSAT]