add sort param support in CDX API class (#156)

see https://nla.github.io/outbackcdx/api.html#operation/query

sort takes string input which must be one of the follwoing:
- default
- closest
- reverse

This commit shall help in closing issue at https://github.com/akamhy/waybackpy/issues/155
This commit is contained in:
Akash Mahanty
2022-02-17 12:17:23 +05:30
committed by GitHub
parent f63c6adf79
commit 3a44a710d3
3 changed files with 38 additions and 0 deletions

View File

@ -6,6 +6,7 @@ from waybackpy.cdx_utils import (
check_collapses,
check_filters,
check_match_type,
check_sort,
full_url,
get_response,
get_total_pages,
@ -101,3 +102,12 @@ def test_check_match_type() -> None:
with pytest.raises(WaybackError):
check_match_type("not a valid type", "url")
def test_check_sort() -> None:
assert check_sort("default")
assert check_sort("closest")
assert check_sort("reverse")
with pytest.raises(WaybackError):
assert check_sort("random crap")