From defd6bca77ff2b56e91b289307d12fe422cda524 Mon Sep 17 00:00:00 2001 From: Serene-Arc Date: Thu, 9 Sep 2021 13:42:18 +1000 Subject: [PATCH] Tweak test conditions --- tests/test_connector.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/test_connector.py b/tests/test_connector.py index 15eede1..a275d9f 100644 --- a/tests/test_connector.py +++ b/tests/test_connector.py @@ -199,10 +199,9 @@ def test_get_subreddit_normal( @pytest.mark.reddit @pytest.mark.parametrize(('test_subreddits', 'search_term', 'limit', 'time_filter', 'max_expected_len'), ( (('Python',), 'scraper', 10, 'all', 10), - (('Python',), '', 10, 'all', 10), + (('Python',), '', 10, 'all', 0), (('Python',), 'djsdsgewef', 10, 'all', 0), (('Python',), 'scraper', 10, 'year', 10), - (('Python',), 'scraper', 10, 'hour', 1), )) def test_get_subreddit_search( test_subreddits: list[str], @@ -226,6 +225,8 @@ def test_get_subreddit_search( assert all([isinstance(res, praw.models.Submission) for res in results]) 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 not any([isinstance(m, MagicMock) for m in results])