def test_comment_order_invalid_sticky(self): self.link.sticky_comment_id = 101 sort = operators.desc("_confidence") builder = CommentBuilder(self.link, sort, num=1500) builder._get_comments() self.assertEqual(builder.comment_order, [100, 101, 102, 104, 105, 106, 103, 107, 108, 110, 109])
def test_comment_order_full_asc(self): sort = operators.asc("_confidence") builder = CommentBuilder(self.link, sort, num=1500) builder._get_comments() self.assertEqual( builder.comment_order, [109, 108, 107, 100, 103, 102, 106, 105, 101, 104, 110])
def test_comment_order_invalid_permalink_defocus(self): sort = operators.desc("_confidence") comment = MagicMock() comment._id = 999999 builder = CommentBuilder(self.link, sort, comment=comment, num=1500) builder._get_comments() self.assertEqual(builder.comment_order, [100, 101, 102, 104, 105, 106, 103, 107, 108, 110, 109])
def test_comment_order_permalink_context(self): sort = operators.desc("_confidence") comment = MagicMock() comment._id = 104 builder = CommentBuilder( self.link, sort, comment=comment, context=3, num=1500) builder._get_comments() self.assertEqual(builder.comment_order, [100, 102, 104])
def test_comment_order_children(self): sort = operators.desc("_confidence") builder = CommentBuilder(self.link, sort, children=[101, 102, 103], num=1500) builder._get_comments() self.assertEqual(builder.comment_order, [101, 102, 104, 105, 106, 103])
def test_comment_order_permalink(self): sort = operators.desc("_confidence") comment = MagicMock() comment._id = 100 builder = CommentBuilder(self.link, sort, comment=comment, num=1500) builder._get_comments() self.assertEqual(builder.comment_order, [100, 101, 102, 104, 105, 106, 103])
def test_comment_order_invalid_sticky(self): self.link.sticky_comment_id = 101 sort = operators.desc("_confidence") builder = CommentBuilder(self.link, sort, num=1500) builder._get_comments() self.assertEqual( builder.comment_order, [100, 101, 102, 104, 105, 106, 103, 107, 108, 110, 109])
def test_comment_order_children_limit(self): sort = operators.desc("_confidence") builder = CommentBuilder( self.link, sort, children=[107, 108, 109], num=3) builder._get_comments() self.assertEqual(builder.comment_order, [107, 108, 110])
def test_comment_order_children(self): sort = operators.desc("_confidence") builder = CommentBuilder( self.link, sort, children=[101, 102, 103], num=1500) builder._get_comments() self.assertEqual(builder.comment_order, [101, 102, 104, 105, 106, 103])
def test_comment_order_depth(self): sort = operators.desc("_confidence") builder = CommentBuilder(self.link, sort, num=1500, max_depth=1) builder._get_comments() self.assertEqual(builder.comment_order, [100, 107, 108, 109])
def test_comment_order_limit(self): sort = operators.desc("_confidence") builder = CommentBuilder(self.link, sort, num=5) builder._get_comments() self.assertEqual(builder.comment_order, [100, 101, 102, 104, 105])
def test_comment_order_full_asc(self): sort = operators.asc("_confidence") builder = CommentBuilder(self.link, sort, num=1500) builder._get_comments() self.assertEqual(builder.comment_order, [109, 108, 107, 100, 103, 102, 106, 105, 101, 104, 110])