summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing/lazytest.py
diff options
context:
space:
mode:
Diffstat (limited to 'rdiff-backup/testing/lazytest.py')
-rw-r--r--rdiff-backup/testing/lazytest.py93
1 files changed, 0 insertions, 93 deletions
diff --git a/rdiff-backup/testing/lazytest.py b/rdiff-backup/testing/lazytest.py
index f1949a7..99bd148 100644
--- a/rdiff-backup/testing/lazytest.py
+++ b/rdiff-backup/testing/lazytest.py
@@ -218,97 +218,4 @@ class MultiplexTest(Iterators):
assert Iter.equal(i2, self.one_to_100())
-class ITRBadder(ITRBranch):
- def start_process(self, index):
- self.total = 0
-
- def end_process(self):
- if self.base_index:
- summand = self.base_index[-1]
- #print "Adding ", summand
- self.total += summand
-
- def branch_process(self, subinstance):
- #print "Adding subinstance ", subinstance.total
- self.total += subinstance.total
-
-class ITRBadder2(ITRBranch):
- def start_process(self, index):
- self.total = 0
-
- def end_process(self):
- #print "Adding ", self.base_index
- self.total += reduce(lambda x,y: x+y, self.base_index, 0)
-
- def can_fast_process(self, index):
- if len(index) == 3: return 1
- else: return None
-
- def fast_process(self, index):
- self.total += index[0] + index[1] + index[2]
-
- def branch_process(self, subinstance):
- #print "Adding branch ", subinstance.total
- self.total += subinstance.total
-
-class TreeReducerTest(unittest.TestCase):
- def setUp(self):
- self.i1 = [(), (1,), (2,), (3,)]
- self.i2 = [(0,), (0,1), (0,1,0), (0,1,1), (0,2), (0,2,1), (0,3)]
-
- self.i1a = [(), (1,)]
- self.i1b = [(2,), (3,)]
- self.i2a = [(0,), (0,1), (0,1,0)]
- self.i2b = [(0,1,1), (0,2)]
- self.i2c = [(0,2,1), (0,3)]
-
- def testTreeReducer(self):
- """testing IterTreeReducer"""
- itm = IterTreeReducer(ITRBadder, [])
- for index in self.i1:
- val = itm(index)
- assert val, (val, index)
- itm.Finish()
- assert itm.root_branch.total == 6, itm.root_branch.total
-
- itm2 = IterTreeReducer(ITRBadder2, [])
- for index in self.i2:
- val = itm2(index)
- if index == (): assert not val
- else: assert val
- itm2.Finish()
- assert itm2.root_branch.total == 12, itm2.root_branch.total
-
- def testTreeReducerState(self):
- """Test saving and recreation of an IterTreeReducer"""
- itm1a = IterTreeReducer(ITRBadder, [])
- for index in self.i1a:
- val = itm1a(index)
- assert val, index
- itm1b = pickle.loads(pickle.dumps(itm1a))
- for index in self.i1b:
- val = itm1b(index)
- assert val, index
- itm1b.Finish()
- assert itm1b.root_branch.total == 6, itm1b.root_branch.total
-
- itm2a = IterTreeReducer(ITRBadder2, [])
- for index in self.i2a:
- val = itm2a(index)
- if index == (): assert not val
- else: assert val
- itm2b = pickle.loads(pickle.dumps(itm2a))
- for index in self.i2b:
- val = itm2b(index)
- if index == (): assert not val
- else: assert val
- itm2c = pickle.loads(pickle.dumps(itm2b))
- for index in self.i2c:
- val = itm2c(index)
- if index == (): assert not val
- else: assert val
- itm2c.Finish()
- assert itm2c.root_branch.total == 12, itm2c.root_branch.total
-
-
if __name__ == "__main__": unittest.main()