cleanups and version inc

This commit is contained in:
Darko Poljak 2014-02-07 08:30:48 +01:00
parent 4a45525d00
commit c38d74feb7

View file

@ -3,7 +3,7 @@
# License: GPLv3 # License: GPLv3
import unittest import unittest
from sweeper import file_dups, iter_file_dups, file_dups_immediate from sweeper import file_dups, iter_file_dups
import os import os
mydir = os.path.dirname(os.path.realpath(__file__)) mydir = os.path.dirname(os.path.realpath(__file__))
@ -23,15 +23,6 @@ class TestSweeper(unittest.TestCase):
for h, flist in dups.items(): for h, flist in dups.items():
self.assertTrue(len(flist) == 1) self.assertTrue(len(flist) == 1)
def test_iter_fule_dups_rethash(self):
for item in iter_file_dups([os.path.join(mydir, 'testfiles_dups')],
rethash=True):
self.assertTrue(type(item).__name__ == 'tuple')
def test_iter_fule_dups_norethash(self):
for item in iter_file_dups([os.path.join(mydir, 'testfiles_dups')]):
self.assertTrue(type(item).__name__ == 'list')
# does not actually test safe_mode, we would need to find # does not actually test safe_mode, we would need to find
# hash collision # hash collision
def test_file_dups_safe_mode(self): def test_file_dups_safe_mode(self):
@ -42,13 +33,23 @@ class TestSweeper(unittest.TestCase):
dups_exist = True dups_exist = True
self.assertTrue(dups_exist) self.assertTrue(dups_exist)
def test_file_dups_immediate_dups(self): def test_iter_file_dups_dups(self):
it = file_dups_immediate([os.path.join(mydir, 'testfiles_dups')]) it = iter_file_dups([os.path.join(mydir, 'testfiles_dups')])
dups_exist = False
for x in it:
dups_exist = True
filepath, h, dups = x
self.assertNotIn(filepath, dups)
self.assertTrue(len(dups) > 0)
self.assertTrue(dups_exist)
def test_iter_file_dups_nodups(self):
it = iter_file_dups([os.path.join(mydir, 'testfiles_nodups')])
dups_exist = False dups_exist = False
for x in it: for x in it:
dups_exist = True dups_exist = True
break break
self.assertTrue(dups_exist) self.assertFalse(dups_exist)
if __name__ == '__main__': if __name__ == '__main__':