add a test for incdec with a count
This commit is contained in:
parent
060305279c
commit
d4c16aa3c7
@ -620,6 +620,32 @@ class TestIncDecNumber:
|
||||
base_url, incdec, segments={'host', 'path', 'query', 'anchor'})
|
||||
assert new_url == expected_url
|
||||
|
||||
@pytest.mark.parametrize('incdec', ['increment', 'decrement'])
|
||||
@pytest.mark.parametrize('value', [
|
||||
'{}foo', 'foo{}', 'foo{}bar', '42foo{}'
|
||||
])
|
||||
@pytest.mark.parametrize('url', [
|
||||
'http://example.com:80/v1/path/{}/test',
|
||||
'http://example.com:80/v1/query_test?value={}',
|
||||
'http://example.com:80/v1/anchor_test#{}',
|
||||
'http://host_{}_test.com:80',
|
||||
'http://m4ny.c0m:80/number5/3very?where=yes#{}'
|
||||
])
|
||||
@pytest.mark.parametrize('count', [1, 5, 100])
|
||||
def test_incdec_number_count(self, incdec, value, url, count):
|
||||
"""Test incdec_number with valid URLs and a count."""
|
||||
base_value = value.format(20)
|
||||
if incdec == 'increment':
|
||||
expected_value = value.format(20 + count)
|
||||
else:
|
||||
expected_value = value.format(20 - count)
|
||||
|
||||
base_url = QUrl(url.format(base_value))
|
||||
expected_url = QUrl(url.format(expected_value))
|
||||
new_url = urlutils.incdec_number(
|
||||
base_url, incdec, count, segments={'host', 'path', 'query', 'anchor'})
|
||||
assert new_url == expected_url
|
||||
|
||||
@pytest.mark.parametrize('number, expected, incdec', [
|
||||
('01', '02', 'increment'),
|
||||
('09', '10', 'increment'),
|
||||
|
Loading…
Reference in New Issue
Block a user