def qa_check(comments): reported_comments = set() for comment in comments: for a, b in core.get_pairs(comment): if '?' in str(a) and '?' in str(b): reported_comments.add(a) reported_comments.add(b) if '?' not in str(a) and '?' not in str(b): reported_comments.add(a) reported_comments.add(b) return reported_comments
def should_get_pairs_nested_tree(self): comment3 = Comment('Comment 3') comment2 = Comment('Comment 2', replies=[comment3]) comment1 = Comment('Comment 1', replies=[comment2]) assert set([(comment1, comment2), (comment2, comment3)]) == set(get_pairs(comment1))
def should_get_pairs(self): comment2 = Comment('Comment 2') comment1 = Comment('Comment 1', replies=[comment2]) assert set([(comment1, comment2)]) == set(get_pairs(comment1))