Skip to content

Commit

Permalink
Fix: ManifestPartition.from_json does not convert search_after to tup…
Browse files Browse the repository at this point in the history
…le (#3291, PR #3418)
  • Loading branch information
jessebrennan committed Sep 20, 2021
2 parents ddfc0f4 + edae751 commit 0a40364
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/azul/service/manifest_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,10 @@ class ManifestPartition:

@classmethod
def from_json(cls, partition: JSON) -> 'ManifestPartition':
# FIXME: Should convert search_after from list back to tuple
# https://github.com/databiosphere/azul/issues/3291
return cls(**partition)
return cls(**{
k: tuple(v) if isinstance(v, list) else v
for k, v in partition.items()
})

def to_json(self) -> MutableJSON:
return attr.asdict(self)
Expand Down
4 changes: 1 addition & 3 deletions test/service/test_manifest_async.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,7 @@ def test(self, mock_uuid, mock_helper):
part_etags=('some_etag',),
page_index=512,
is_last_page=False,
# FIXME: Should really be a tuple
# https://github.com/databiosphere/azul/issues/3291
search_after=['foo', 'doc#bar']) # type: ignore
search_after=('foo', 'doc#bar'))
)

with mock.patch.object(ManifestService, 'get_manifest') as mock_get_manifest:
Expand Down

0 comments on commit 0a40364

Please sign in to comment.