Пример #1
0
def test_pagination_result():
    result = PagedResult(items=["dummy"], page_size=2, page_number=1)
    assert result.page_url(0) is None
    assert result.page_url(2) is None
    assert repr(result) == "<PagedResult items=[1 items] page=1>"
    assert result == PagedResult(items=["dummy"], page_size=2, page_number=1)
    with pytest.raises(ValueError):
        result == object()
Пример #2
0
def test_pagination_result_no_paging():
    result = PagedResult(items=["dummy"], page_size=0, page_number=1)
    assert result.total_pages == 1