diff --git a/bioblend/_tests/TestGalaxyHistories.py b/bioblend/_tests/TestGalaxyHistories.py index 160b6eb5c..b1ae681b9 100644 --- a/bioblend/_tests/TestGalaxyHistories.py +++ b/bioblend/_tests/TestGalaxyHistories.py @@ -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(first) == 1 + 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 diff --git a/bioblend/galaxy/dataset_collections/__init__.py b/bioblend/galaxy/dataset_collections/__init__.py index addd84a32..e1dff9b20 100644 --- a/bioblend/galaxy/dataset_collections/__init__.py +++ b/bioblend/galaxy/dataset_collections/__init__.py @@ -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: diff --git a/bioblend/galaxy/histories/__init__.py b/bioblend/galaxy/histories/__init__.py index 93e04fa47..6efc6f204 100644 --- a/bioblend/galaxy/histories/__init__.py +++ b/bioblend/galaxy/histories/__init__.py @@ -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.