Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions synchros2/synchros2/launch/actions.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,23 +60,23 @@ def __init__(self, enum_type: Type[Enum], *args: Any, optional: bool = False, **
raise KeyError("Cannot set `choices` for `DeclareEnumLaunchArgument`")
if "default_value" in kwargs:
default_value = kwargs["default_value"]
if isinstance(default_value, str):
if default_value not in choices:
if isinstance(default_value, enum_type):
if default_value not in enum_type:
raise ValueError(
(
f"For an Enum Launch Argument of type {enum_type.__name__}, the `default_value` must be"
f" from {choices} or {list(enum_type)}"
),
)
elif isinstance(default_value, enum_type):
if default_value not in enum_type:
kwargs["default_value"] = str(default_value.value)
elif isinstance(default_value, str):
if default_value not in choices:
raise ValueError(
(
f"For an Enum Launch Argument of type {enum_type.__name__}, the `default_value` must be"
f" from {choices} or {list(enum_type)}"
),
)
kwargs["default_value"] = str(default_value.value)
else:
raise TypeError(
(
Expand Down
Loading