def test_submission_comment_id_exception(): with pytest.raises(ValueError): api = PushshiftAPI() def fxn(item): return item['score'] > 2 posts = api.search_submission_comment_ids(ids=post_ids, filter_fn=fxn)
def test_response_load_cache(): api = PushshiftAPI(file_checkpoint=1) comments = api.search_submission_comment_ids(ids=post_ids, mem_safe=True) resp = Response.load_cache(key=comments._cache.key) assert (len(comments) == len(resp) and len(comments) == 66)
def test_response_generator(): api = PushshiftAPI(file_checkpoint=1) comments = api.search_submission_comment_ids(ids=post_ids, mem_safe=True) all_c = [c for c in comments] assert (len(all_c) == 66)
def test_submission_comment_ids_search(): api = PushshiftAPI(file_checkpoint=1) comments = api.search_submission_comment_ids(ids=post_ids) assert (len(comments) == 66)
def test_submission_comment_ids_praw_mem_safe(): api_praw = PushshiftAPI(file_checkpoint=1, praw=reddit) comments = api_praw.search_submission_comment_ids(ids=post_ids, mem_safe=True) assert (len(comments) == 66)