6 class TestComputeWeightedReplicationCosts(unittest.TestCase):
7 def test_obvious(self):
8 self.assertEqual(datamanager.computeWeightedReplicationCosts([1,]),
11 def test_simple(self):
12 self.assertEqual(datamanager.computeWeightedReplicationCosts([2,]),
15 def test_even_split(self):
16 self.assertEqual(datamanager.computeWeightedReplicationCosts([1,1]),
19 def test_even_split_bigger(self):
20 self.assertEqual(datamanager.computeWeightedReplicationCosts([2,2]),
23 def test_uneven_split(self):
24 self.assertEqual(datamanager.computeWeightedReplicationCosts([1,2]),
27 def test_uneven_split_bigger(self):
28 self.assertEqual(datamanager.computeWeightedReplicationCosts([1,3]),
31 def test_uneven_split_jumble(self):
32 self.assertEqual(datamanager.computeWeightedReplicationCosts([1,3,6,6,10]),
33 {1:0.2, 3:0.7, 6:1.7, 10:5.7})
35 def test_documentation_example(self):
36 self.assertEqual(datamanager.computeWeightedReplicationCosts([1,1,3,6,6]),
37 {1:0.2, 3: 0.2 + 2.0 / 3, 6: 0.2 + 2.0 / 3 + 1.5})
40 if __name__ == '__main__':