lint tests
Lint with [refurb](https://github.com/dosisod/refurb) using `--disable 126 --python-version 3.9` Also update bats to 1.8.2 and bats-assets to 2.1.0. No changes to the tests, all still passing.
This commit is contained in:
parent
831f49daa6
commit
ef7fcce1cc
|
@ -1,7 +1,7 @@
|
|||
[pytest]
|
||||
addopts = --strict-markers
|
||||
markers =
|
||||
online: tests require a connection to the internet
|
||||
reddit: tests require a connection to Reddit
|
||||
slow: test is slow to run
|
||||
authenticated: test requires an authenticated Reddit instance
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit ce5ca2802fabe5dc38393240cd40e20f8928d3b0
|
||||
Subproject commit e8c840b58f0833e23461c682655fe540aa923f85
|
|
@ -1 +1 @@
|
|||
Subproject commit e0de84e9c011223e7f88b7ccf1c929f4327097ba
|
||||
Subproject commit 78fa631d1370562d2cd4a1390989e706158e7bf0
|
|
@ -47,7 +47,7 @@ def assert_all_results_are_submissions(result_limit: int, results: list[Iterator
|
|||
|
||||
def assert_all_results_are_submissions_or_comments(result_limit: int, results: list[Iterator]) -> list:
|
||||
results = [sub for res in results for sub in res]
|
||||
assert all([isinstance(res, praw.models.Submission) or isinstance(res, praw.models.Comment) for res in results])
|
||||
assert all([isinstance(res, (praw.models.Submission, praw.models.Comment)) for res in results])
|
||||
assert not any([isinstance(m, MagicMock) for m in results])
|
||||
if result_limit is not None:
|
||||
assert len(results) == result_limit
|
||||
|
@ -259,7 +259,7 @@ def test_get_subreddit_search(
|
|||
assert all([res.subreddit.display_name in test_subreddits for res in results])
|
||||
assert len(results) <= max_expected_len
|
||||
if max_expected_len != 0:
|
||||
assert len(results) > 0
|
||||
assert results
|
||||
assert not any([isinstance(m, MagicMock) for m in results])
|
||||
|
||||
|
||||
|
@ -356,7 +356,7 @@ def test_get_subscribed_subreddits(downloader_mock: MagicMock, authenticated_red
|
|||
downloader_mock.sort_filter = RedditTypes.SortType.HOT
|
||||
results = RedditConnector.get_subreddits(downloader_mock)
|
||||
assert all([isinstance(s, praw.models.ListingGenerator) for s in results])
|
||||
assert len(results) > 0
|
||||
assert results
|
||||
|
||||
|
||||
@pytest.mark.parametrize(('test_name', 'expected'), (
|
||||
|
|
|
@ -152,7 +152,7 @@ def test_download_submission_hash_exists(
|
|||
RedditDownloader._download_submission(downloader_mock, submission)
|
||||
folder_contents = list(tmp_path.iterdir())
|
||||
output = capsys.readouterr()
|
||||
assert len(folder_contents) == 0
|
||||
assert not folder_contents
|
||||
assert re.search(r'Resource hash .*? downloaded elsewhere', output.out)
|
||||
|
||||
|
||||
|
|
|
@ -66,6 +66,6 @@ def test_token_manager_write(example_config: configparser.ConfigParser, tmp_path
|
|||
test_manager = OAuth2TokenManager(example_config, test_path)
|
||||
test_manager.post_refresh_callback(mock_authoriser)
|
||||
assert example_config.get('DEFAULT', 'user_token') == 'changed_token'
|
||||
with open(test_path, 'r') as file:
|
||||
with test_path.open('r') as file:
|
||||
file_contents = file.read()
|
||||
assert 'user_token = changed_token' in file_contents
|
||||
|
|
Loading…
Reference in a new issue