-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Resolve flake8 violations in tests/ #428
Changes from 2 commits
165c51a
8703991
be53c4a
a534be0
5ee8d8e
c71cfcb
5df8aa0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,21 +20,18 @@ | |
from linkcheck.cache.results import ResultCache | ||
from linkcheck.cache.urlqueue import Empty, NUM_PUTS_CLEANUP, UrlQueue | ||
|
||
UrlData = namedtuple('UrlData', 'url cache_url aggregate has_result') | ||
Aggregate = namedtuple('Aggregate', 'result_cache') | ||
UrlData = namedtuple("UrlData", "url cache_url aggregate has_result") | ||
Aggregate = namedtuple("Aggregate", "result_cache") | ||
|
||
|
||
class TestUrlQueue(unittest.TestCase): | ||
|
||
def setUp(self): | ||
self.result_cache = ResultCache() | ||
self.urlqueue = UrlQueue() | ||
self.urldata1 = UrlData( | ||
url="Foo", | ||
cache_url="Foo", | ||
aggregate=Aggregate( | ||
result_cache=self.result_cache, | ||
), | ||
aggregate=Aggregate(result_cache=self.result_cache,), | ||
has_result=True, | ||
) | ||
|
||
|
@@ -72,9 +69,7 @@ def test_put_get(self): | |
the item and it can be get only once | ||
""" | ||
self.urlqueue.put(self.urldata1) | ||
cached_item = ( | ||
self.result_cache.get_result(self.urldata1) | ||
) | ||
cached_item = self.result_cache.get_result(self.urldata1) | ||
self.assertEqual(cached_item, None) | ||
self.assertEqual(self.urlqueue.get(), self.urldata1) | ||
with self.assertRaises(Empty): | ||
|
@@ -89,9 +84,7 @@ def test_put_has_result_false(self): | |
urldata = UrlData( | ||
url="Bar", | ||
cache_url="Bar", | ||
aggregate=Aggregate( | ||
result_cache=self.result_cache, | ||
), | ||
aggregate=Aggregate(result_cache=self.result_cache,), | ||
has_result=False, | ||
) | ||
self.urlqueue.put(urldata) | ||
|
@@ -109,9 +102,7 @@ def test_put_has_result_true(self): | |
urldata = UrlData( | ||
url="Bar", | ||
cache_url="Bar", | ||
aggregate=Aggregate( | ||
result_cache=self.result_cache, | ||
), | ||
aggregate=Aggregate(result_cache=self.result_cache,), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There are many unnecessary trailing commas like this. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, "many" ~= 6 or 7, in this file, all about There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
that have the bad trailing comma right in front of the closing parenthesis. All other trailing commas like this are in 1-tuples, where they belong. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Another manual check to add to the process. |
||
has_result=True, | ||
) | ||
self.urlqueue.put(urldata) | ||
|
@@ -129,9 +120,7 @@ def test_put_cache(self): | |
urldata = UrlData( | ||
url="Bar", | ||
cache_url="Foo", | ||
aggregate=Aggregate( | ||
result_cache=self.result_cache, | ||
), | ||
aggregate=Aggregate(result_cache=self.result_cache,), | ||
has_result=True, | ||
) | ||
self.urlqueue.put(urldata) | ||
|
@@ -152,19 +141,15 @@ def test_cleanup(self): | |
UrlData( | ||
url="Bar", | ||
cache_url="Bar address %s" % i, | ||
aggregate=Aggregate( | ||
result_cache=self.result_cache, | ||
), | ||
aggregate=Aggregate(result_cache=self.result_cache,), | ||
has_result=False, | ||
), | ||
) | ||
self.assertEqual(self.urlqueue.qsize(), NUM_PUTS_CLEANUP - 1) | ||
urldata = UrlData( | ||
url="Bar", | ||
cache_url="Bar address", | ||
aggregate=Aggregate( | ||
result_cache=self.result_cache, | ||
), | ||
aggregate=Aggregate(result_cache=self.result_cache,), | ||
has_result=False, | ||
) | ||
self.result_cache.add_result("Bar address 2", "asdf") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Black is wonderful, but it does make bad decisions sometimes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.