Closed cboulay closed 9 months ago
I'm guessing that raising the AssertionError when self.location
is None is intentional (it's explicitly tested in the unit tests).
So maybe this should only be fixed at the Stream.__repr__
level.
Instead of
def __repr__(self) -> str:
return f"Stream:{self.address}[{self.msg_type}]"
We can use
def __repr__(self) -> str:
_addr = self.address if self._location is not None else "unlocated"
return f"Stream:{_addr}[{self.msg_type}]"
The above test then prints
InputStream:unlocated[typing.Any]()
Stream:unlocated[typing.Any]
ezmsg.core.stream.Stream
overrides its__repr__
which includes itsself.address
.self.address
is a property inherited from the parentAddressable
class.address
is a simple construct usingself.location
. Ifself.location
is None then an AssertionError is raised upon its access.location
is None unless it has had its_set_location
called, which afaict only happens duringExecutionContext.setup
.Reproduce with: