1
0
Fork 0
mirror of synced 2025-07-04 12:27:32 +02:00

Implement lightweight cleaning for jpg

This commit is contained in:
jvoisin 2018-10-24 19:35:07 +02:00
parent 1040a594d6
commit fe885babee
2 changed files with 27 additions and 4 deletions

View file

@ -4,7 +4,7 @@ import unittest
import shutil
import os
from libmat2 import pdf, images
from libmat2 import pdf, images, torrent
class TestLightWeightCleaning(unittest.TestCase):
def test_pdf(self):
@ -63,3 +63,20 @@ class TestLightWeightCleaning(unittest.TestCase):
os.remove('./tests/data/clean.jpg')
os.remove('./tests/data/clean.cleaned.jpg')
def test_torrent(self):
shutil.copy('./tests/data/dirty.torrent', './tests/data/clean.torrent')
p = torrent.TorrentParser('./tests/data/clean.torrent')
meta = p.get_meta()
self.assertEqual(meta['created by'], b'mktorrent 1.0')
p.lightweight_cleaning = True
ret = p.remove_all()
self.assertTrue(ret)
p = torrent.TorrentParser('./tests/data/clean.cleaned.torrent')
self.assertEqual(p.get_meta(), {})
os.remove('./tests/data/clean.torrent')
os.remove('./tests/data/clean.cleaned.torrent')