NNTPSimpleFilter_Test.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:newsreap 作者: caronc 项目源码 文件源码
def test_scoring_compressed_files(self):
        """
        Test that we correctly score compressed files
        """

        sf = NNTPSimpleFilter()
        entry = copy(self.template_entry)

        # Expected Score
        score = 25

        # Test against video files:
        for e in [ 'rar', '7z', 'zip', 'tgz', 'tar.gz']:

            entry['subject'] = 'What.A.Great.Archive (1/1) ' +\
                    '"what.a.great.archive.%s" Yenc (1/1)' % e

            assert sf.score(**entry) == score

            # now test that we can support .??? extensions after
            # the initial one
            for i in range(1000):
                entry['subject'] = 'What.A.Great.Archive (1/1) ' +\
                        '"what.a.great.archive.%s.%.3d" Yenc (1/1)' % (e, i)
                assert sf.score(**entry) == score

        # Test Sub Rar and Zip files (R?? and Z??)
        for e in [ 'r', 'z' ]:
            for i in range(100):
                entry['subject'] = 'What.A.Great.Archive (1/1) ' +\
                    '"what.a.great.archive.%s%.2d" Yenc (1/1)' % (e, i)

                assert sf.score(**entry) == score
                for ii in range(1000):
                    entry['subject'] = 'What.A.Great.Archive (1/1) ' +\
                        '"what.a.great.archive.%s%.2d.%.3d" Yenc (1/1)' % (
                            e, i, ii)
                    assert sf.score(**entry) == score
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号