Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix docs for offset in get_histories and add test #486

Merged
merged 5 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from 4 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
9 changes: 9 additions & 0 deletions bioblend/_tests/TestGalaxyHistories.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,15 @@ def test_get_histories(self):
all_histories = self.gi.histories.get_histories()
assert len(all_histories) > 0

# Test limit and offset
first = self.gi.histories.get_histories(limit=1)
others = self.gi.histories.get_histories(offset=1)
assert len(others) > 0 # guess the test makes more sense with at least 2 histories
bernt-matthias marked this conversation as resolved.
Show resolved Hide resolved
assert [h["id"] for h in all_histories] == [h["id"] for h in first] + [h["id"] for h in others]

out_of_limit = self.gi.histories.get_histories(offset=1000000)
assert out_of_limit == []

# Check whether id is present, when searched by name
histories = self.gi.histories.get_histories(name=self.default_history_name)
assert len([h for h in histories if h["id"] == self.history["id"]]) == 1
Expand Down
2 changes: 1 addition & 1 deletion bioblend/galaxy/dataset_collections/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def __init__(
self.name = name
self.type = type
if isinstance(elements, dict):
self.elements: List[Union["CollectionElement", "SimpleElement"]] = [
self.elements: List[Union[CollectionElement, SimpleElement]] = [
HistoryDatasetElement(name=key, id=value) for key, value in elements.values()
]
elif elements:
Expand Down
4 changes: 2 additions & 2 deletions bioblend/galaxy/histories/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ def get_histories(
:param limit: How many items to return (upper bound).

:type offset: int
:param offset: skip the first ( offset - 1 ) items and begin returning
at the Nth item.
:param offset: skip the first (offset) items and begin returning
items at index offset (i.e. start with the element offset+1).

:rtype: list
:return: List of history dicts.
Expand Down