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

17 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-09-29 10:17 +0000

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

2 

3from __future__ import annotations 

4from enum import Enum 

5 

6 

7class SolverStatus(str, Enum): 

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

9 

10 SUCCESS = "SUCCESS" # Positive status 

11 SAT = "SAT" # SAT specific positive status 

12 UNSAT = "UNSAT" # SAT specific positive status 

13 

14 # Negative status 

15 UNKNOWN = "UNKNOWN" 

16 CRASHED = "CRASHED" 

17 TIMEOUT = "TIMEOUT" 

18 WRONG = "WRONG" 

19 ERROR = "ERROR" 

20 KILLED = "KILLED" 

21 

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

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

24 return str(self.value) 

25 

26 @property 

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

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

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