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
评论列表
文章目录