Skip to content

Commit

Permalink
🐛 Fix ValueError String, specify value type, and remove unnecessary e…
Browse files Browse the repository at this point in the history
…lse from equilibrium.py
  • Loading branch information
Athoy Nilima committed Feb 28, 2024
1 parent 26913ea commit 3c9ff6d
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions bluemira/equilibria/equilibrium.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ class VerticalPositionControlType(Enum):
FEEDBACK = auto()

@classmethod
def _missing_(cls, value):
def _missing_(cls, value: str):
try:
return cls[value.upper()]
except KeyError:
raise ValueError(
"Please select a numerical stabilisation strategy"
' from: 1) "virtual" \n 2) "feedback" 3) None.'
f"{cls.__name__} has no strategy {value}"
f"please select from {*cls._member_names_, }"
) from None


Expand Down Expand Up @@ -1073,13 +1073,8 @@ def set_vcontrol(self, vcontrol_str: Optional[str] = None):
vcontrol_type = VerticalPositionControlType(vcontrol_str)
if vcontrol_type is VerticalPositionControlType.VIRTUAL:
self.controller = VirtualController(self, gz=2.2)
elif vcontrol_type is VerticalPositionControlType.FEEDBACK:
if vcontrol_type is VerticalPositionControlType.FEEDBACK:

Check warning on line 1076 in bluemira/equilibria/equilibrium.py

View check run for this annotation

Codecov / codecov/patch

bluemira/equilibria/equilibrium.py#L1076

Added line #L1076 was not covered by tests
raise NotImplementedError
else:
raise ValueError(
"Please select a numerical stabilisation strategy"
' from: 1) "virtual" \n 2) "feedback" 3) None.'
)

def solve(self, jtor: Optional[np.ndarray] = None, psi: Optional[np.ndarray] = None):
"""
Expand Down

0 comments on commit 3c9ff6d

Please sign in to comment.