rename url_incdec_number to incdec_number

This commit is contained in:
Daniel 2015-08-08 00:08:06 +02:00
parent 276b163e0d
commit c4c3a83ac0
3 changed files with 12 additions and 12 deletions

View File

@ -472,7 +472,7 @@ class CommandDispatcher:
window: Open the link in a new window.
"""
try:
new_url = urlutils.url_incdec_number(url, incdec)
new_url = urlutils.incdec_number(url, incdec)
except urlutils.IncDecError as error:
raise cmdexc.CommandError(error.msg)
self._open(new_url, tab, background, window)

View File

@ -447,7 +447,7 @@ class FuzzyUrlError(Exception):
class IncDecError(Exception):
"""Exception raised by url_incdec_number on problems.
"""Exception raised by incdec_number on problems.
Attributes:
msg: The error message.
@ -463,7 +463,7 @@ class IncDecError(Exception):
return '{}: {}'.format(self.msg, self.url.toString())
def url_incdec_number(url, incdec):
def incdec_number(url, incdec):
"""Find a number in the url and increment or decrement it.
Args:

View File

@ -536,9 +536,9 @@ def test_same_domain_invalid_url(url1, url2):
("http://bbc.c0.uk:80/story_1", "decrement", "http://bbc.c0.uk:80/story_0"),
("http://mydomain.tld/2_%C3%A4", "decrement", "http://mydomain.tld/1_%C3%A4"),
])
def test_url_incdec_number(url, incdec, output):
"""Test url_incdec_number with valid URLs."""
new_url = urlutils.url_incdec_number(QUrl(url), incdec)
def test_incdec_number(url, incdec, output):
"""Test incdec_number with valid URLs."""
new_url = urlutils.incdec_number(QUrl(url), incdec)
assert new_url == QUrl(output)
@pytest.mark.parametrize('url', [
@ -549,14 +549,14 @@ def test_url_incdec_number(url, incdec, output):
"http://example.com/%C3%B6/urlencoded/data",
"http://www2.ex4mple.com:42/all/of/the/%C3%A4bove",
])
def test_url_incdec_number_invalid(url):
"""Test url_incdec_number with URLs that don't contain a number."""
def test_incdec_number_invalid(url):
"""Test incdec_number with URLs that don't contain a number."""
with pytest.raises(urlutils.IncDecError):
urlutils.url_incdec_number(QUrl(url), "increment")
urlutils.incdec_number(QUrl(url), "increment")
def test_url_incdec_number_below_0():
"""Test url_incdec_number with a number that would be below zero
def test_incdec_number_below_0():
"""Test incdec_number with a number that would be below zero
after decrementing."""
with pytest.raises(urlutils.IncDecError):
urlutils.url_incdec_number(QUrl('http://example.com/page_0.html'),
urlutils.incdec_number(QUrl('http://example.com/page_0.html'),
'decrement')