fediverse-devnet / feditest

A testing framework for distributed, heterogeneous systems communicating with complex protocols, such as the Fediverse
https://feditest.org/
MIT License
31 stars 6 forks source link

activitypub.Collection.items incorrect logic? #289

Open steve-bate opened 1 month ago

steve-bate commented 1 month ago

The first and next variables are compared to None and set to a bool value. The isinstance(..., str) looks like it will never succeed (based on my testing).

    def items(self) -> Iterator[AnyObject]:
        items = self._delegate.json_field('orderedItems' if self.is_ordered() else 'items')
        if items is not None:
# ...
        elif first := self._delegate.json_field('first') is not None: # <-- first will always be a bool
            if isinstance(first,str): # <-- is never true?
                first_collection = AnyObject(first).as_collection()
                yield from first_collection.items()
            else:
                raise Exception(f'Cannot process yet: {first}')
        elif next := self._delegate.json_field('next') is not None:
            # similar issue for next ...