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
4 changes: 2 additions & 2 deletions amber/src/main/python/core/models/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def on_finish(self, port: int) -> Iterator[Optional[TupleLike]]:


class SourceOperator(TupleOperatorV2):
__internal_is_source = True
Comment thread
Ma77Ball marked this conversation as resolved.
_Operator__internal_is_source = True

@abstractmethod
def produce(self) -> Iterator[Union[TupleLike, TableLike, None]]:
Expand Down Expand Up @@ -267,7 +267,7 @@ class TableOperator(TupleOperatorV2):

def __init__(self):
super().__init__()
self.__internal_is_source: bool = False
self._Operator__internal_is_source: bool = False
self.__table_data: Mapping[int, List[Tuple]] = defaultdict(list)

@overrides.final
Expand Down
25 changes: 1 addition & 24 deletions amber/src/test/python/core/models/test_operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,30 +154,7 @@ def test_setter_can_flip_back_to_false(self):
op.is_source = False
assert op.is_source is False

def test_source_operator_class_attr_storage_diverges_from_property_read(
self,
):
# Documents the underlying defect without claiming a contract: the class
# attribute is stored under one mangled name, the property reads from
# another, so they cannot agree. Asserting the two attributes directly
# decouples this from the eventual is_source-on-SourceOperator fix.
src = _ConcreteSource()
# The mangled attribute SourceOperator set — present but unused:
assert getattr(src, "_SourceOperator__internal_is_source") is True
# The attribute Operator.is_source actually reads — still the default:
assert getattr(src, "_Operator__internal_is_source") is False

@pytest.mark.xfail(
strict=True,
reason=(
"Known bug: SourceOperator's __internal_is_source class attribute "
"is name-mangled to _SourceOperator__internal_is_source, while "
"Operator.is_source reads _Operator__internal_is_source. The "
"intended contract is is_source=True on SourceOperator instances; "
"this xfail flips to XPASS when the bug is fixed."
),
)
def test_source_operator_subclass_should_report_is_source_true(self):
def test_source_operator_subclass_reports_is_source_true(self):
src = _ConcreteSource()
assert src.is_source is True

Expand Down