def test_get_subreddit_normal(
        test_subreddits: list[str],
        limit: int,
        sort_type: str,
        time_filter: str,
        max_expected_len: int,
        downloader_mock: MagicMock,
        reddit_instance: praw.Reddit,
):
    downloader_mock._determine_sort_function.return_value = praw.models.Subreddit.hot
    downloader_mock.args.limit = limit
    downloader_mock.args.sort = sort_type
    downloader_mock.args.subreddit = test_subreddits
    downloader_mock.reddit_instance = reddit_instance
    downloader_mock.sort_filter = RedditDownloader._create_sort_filter(downloader_mock)
    results = RedditDownloader._get_subreddits(downloader_mock)
    test_subreddits = downloader_mock._split_args_input(test_subreddits)
    results = [sub for res1 in results for sub in res1]
    assert all([isinstance(res1, praw.models.Submission) for res1 in results])
    assert all([res.subreddit.display_name in test_subreddits for res in results])
    assert len(results) <= max_expected_len
def test_get_subreddit_search(
        test_subreddits: list[str],
        search_term: str,
        time_filter: str,
        limit: int,
        max_expected_len: int,
        downloader_mock: MagicMock,
        reddit_instance: praw.Reddit,
):
    downloader_mock._determine_sort_function.return_value = praw.models.Subreddit.hot
    downloader_mock.args.limit = limit
    downloader_mock.args.search = search_term
    downloader_mock.args.subreddit = test_subreddits
    downloader_mock.reddit_instance = reddit_instance
    downloader_mock.sort_filter = RedditTypes.SortType.HOT
    downloader_mock.args.time = time_filter
    downloader_mock.time_filter = RedditDownloader._create_time_filter(downloader_mock)
    results = RedditDownloader._get_subreddits(downloader_mock)
    results = [sub for res in results for sub in res]
    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