def test_process_limit_lower_than_zero(self): with pytest.raises(ValueError) as ex: utils.process_limit(1, None, -3) assert 'can not be < 0' in str(ex.value) with pytest.raises(ValueError) as ex: utils.process_limit(-1, None, 3) assert 'can not be < 0' in str(ex.value)
def test_process_limit_no_start_page(self): start, limit = utils.process_limit(start=None, page=None, limit=5) assert start == 0 assert limit == 5
def test_process_limit_start(self): start, limit = utils.process_limit(start=1, page=None, limit=5) assert start == 1 assert limit == 5
def test_process_limit_start_and_page(self): with pytest.raises(ValueError) as ex: utils.process_limit(1, 2, 3) assert 'at the same time' in str(ex.value)