diff options
Diffstat (limited to 'rdiff-backup/testing/destructive_steppingtest.py')
-rw-r--r-- | rdiff-backup/testing/destructive_steppingtest.py | 43 |
1 files changed, 6 insertions, 37 deletions
diff --git a/rdiff-backup/testing/destructive_steppingtest.py b/rdiff-backup/testing/destructive_steppingtest.py index 528561d..b44a999 100644 --- a/rdiff-backup/testing/destructive_steppingtest.py +++ b/rdiff-backup/testing/destructive_steppingtest.py @@ -1,7 +1,7 @@ from __future__ import generators import unittest execfile("commontest.py") -rbexec("destructive_stepping.py") +rbexec("selection.py") @@ -15,13 +15,15 @@ class DSTest(unittest.TestCase): def testDSIter(self): """Testing destructive stepping iterator from baserp""" for i in range(2): - ds_iter = DestructiveStepping.Iterate_with_Finalizer( - self.noperms, 1) + sel = Select(self.noperms, 1) + sel.set_iter() + ds_iter = sel.iterate_with_finalizer() noperms = ds_iter.next() assert noperms.isdir() and noperms.getperms() == 0 bar = ds_iter.next() - assert bar.isreg() and bar.getperms() == 0 + assert bar.isreg() and bar.getperms() == 0, \ + "%s %s" % (bar.isreg(), bar.getperms()) barbuf = bar.open("rb").read() assert len(barbuf) > 0 @@ -36,37 +38,4 @@ class DSTest(unittest.TestCase): self.assertRaises(StopIteration, ds_iter.next) - def testIterate_from(self): - """Tests basic iteration by Iterate_from""" - iter = DestructiveStepping.Iterate_from(self.iteration_dir, 1) - l = [] - for rp in iter: l.append(rp.index) - assert l == [(), - ('1',), - ('2',), - ('3',), ('3','2'), ('3','3'), - ('4',), - ('5',), ('5','1'), ('5','2'), ('5','2','1'), - ('6',), ('6','3'), - ('6','3','1'), ('6','3','2'), ('6','4'), - ('7',)], l - - def testIterate_from_index(self): - """Test iteration from a given index""" - iter = DestructiveStepping.Iterate_from(self.iteration_dir, 1, ('3',)) - l = [] - for rp in iter: l.append(rp.index) - assert l == [('3','2'), ('3','3'), - ('4',), - ('5',), ('5','1'), ('5','2'), ('5','2','1'), - ('6',), ('6','3'), - ('6','3','1'), ('6','3','2'), ('6','4'), - ('7',)], l - iter = DestructiveStepping.Iterate_from(self.iteration_dir, 1, - ('6','3')) - l = [] - for rp in iter: l.append(rp.index) - assert l == [('6','3','1'), ('6','3','2'), ('6', '4'), - ('7',)], l - if __name__ == "__main__": unittest.main() |