Skip to content

Commit 98803db

Browse files
committed
flake8
1 parent 5e7997a commit 98803db

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

domain_utils/domain_utils.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,10 @@ def get_stripped_url(url, scheme=False, drop_non_http=False, use_netloc=True):
124124
becomes ``my.domain.net/a/path/to/a/file.html``
125125
126126
URL parsing is done using std lib
127-
`urllib.parse.urlparse <https://docs.python.org/3.8/library/urllib.parse.html>`_.
128-
Empty scheme e.g. ``my.domain.cloudfront.net`` are assumed to be http schemes.
127+
`urllib.parse.urlparse
128+
<https://docs.python.org/3.8/library/urllib.parse.html>`_.
129+
Empty scheme e.g. ``my.domain.cloudfront.net``
130+
are assumed to be http schemes.
129131
130132
If a URL has a port but no scheme, urlparse determines the scheme to
131133
be the hostname and we do not handle this special case. In this case,
@@ -147,7 +149,7 @@ def get_stripped_url(url, scheme=False, drop_non_http=False, use_netloc=True):
147149
Default is ``False``.
148150
:type drop_non_http: bool, optional
149151
:param use_netloc: If ``True`` urlparse's netloc will be used.
150-
If ``False`` urlparse's host will be returned. Using netloc means
152+
If ``False`` urlparse's host will be returned. Using netloc means
151153
that a port is included, for example, if it was in the path.
152154
Default is ``True``.
153155
:type use_netloc: bool, optional

tests/test_domain_utils.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,22 +96,22 @@ def test_get_stripped_url_returns_port_if_present_and_use_netloc_false():
9696
Currently don't support urls with a port but no scheme in the way we want.
9797
9898
url = 'my.example.com:8080/path/to/webapp.htm?aced=1'
99-
ParseResult(scheme='my.example.com', netloc='', path='8080/path/to/webapp.htm',...
99+
ParseResult(scheme='my.example.com', netloc='', path='8080/path/to/webapp.htm',
100100
101101
The following are two tests xfailed with expected behavior and one test
102102
that documents the actual behavior
103103
"""
104104

105-
@pytest.mark.xfail(reason="""
106-
urlparse does not have a good way to handle a url with a port but no scheme.""")
105+
port_no_schema_msg = """
106+
urlparse does not have a good way to handle a url with a port but no scheme."""
107+
@pytest.mark.xfail(reason=port_no_schema_msg)
107108
def test_get_stripped_with_port_when_no_scheme():
108109
url = 'my.example.com:8080/path/to/webapp.htm?aced=1'
109110
result = du.get_stripped_url(url)
110111
assert result == 'my.example.com:8080/path/to/webapp.htm'
111112

112113

113-
@pytest.mark.xfail(reason="""
114-
urlparse does not have a good way to handle a url with a port but no scheme.""")
114+
@pytest.mark.xfail(reason=port_no_schema_msg)
115115
def test_get_stripped_url_with_port_when_no_scheme_and_use_netloc_false():
116116
url = 'my.example.com:8080/path/to/webapp.htm?aced=1'
117117
result = du.get_stripped_url(url, use_netloc=False)

0 commit comments

Comments
 (0)