fediverse-devnet / fediverse-devnet/feditest

activitypub.Collection.items incorrect logic?

Open
#289 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
37
Forks
6
PR merge metrics
No merged PRs in 30d

Description

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).

```python
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 ...
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.