Skip to content
Open
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,8 @@ def load_executor_definition(self, code: str) -> type(Operator):
executors = list(
filter(self.is_concrete_operator, executor_module.__dict__.values())
)
assert len(executors) == 1, "There should be one and only one Operator defined"
if len(executors) != 1:
raise ValueError("There should be one and only one Operator defined")
return executors[0]

def close(self) -> None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -407,17 +407,15 @@ def test_update_with_source_mismatch_raises_assertion(self, initialized_manager)
)
assert "SourceOperator API" in str(exc_info.value)

def test_update_with_no_operator_class_raises_assertion(self, initialized_manager):
# load_executor_definition asserts exactly one Operator subclass exists
# in the module — an empty module trips that assertion.
with pytest.raises(AssertionError) as exc_info:
def test_update_with_no_operator_class_is_rejected(self, initialized_manager):
with pytest.raises(ValueError) as exc_info:
initialized_manager.update_executor(code=NO_OPERATOR_CODE, is_source=False)
assert "one and only one Operator" in str(exc_info.value)

def test_update_with_multiple_operator_classes_raises_assertion(
def test_update_with_multiple_operator_classes_is_rejected(
self, initialized_manager
):
with pytest.raises(AssertionError) as exc_info:
with pytest.raises(ValueError) as exc_info:
initialized_manager.update_executor(
code=TWO_OPERATORS_CODE, is_source=False
)
Expand Down
Loading