@@ 65-75 (lines=11) @@ | ||
62 | result = tested_object.should_continue(best_particle) |
|
63 | self.assertFalse(result) |
|
64 | ||
65 | def test_should_continue_false_not_safe_cost(self): |
|
66 | process, stages = self.get_basic_process() |
|
67 | tested_object = CreditCallsGroupOptimizationStrategy(stages, process) |
|
68 | tested_object.initialize() |
|
69 | best_particle = Mock() |
|
70 | best_particle.best_quality = 2 |
|
71 | stages[0].get_cost.return_value = 20 |
|
72 | stages[1].get_cost.return_value = 20 |
|
73 | stages[2].get_cost.return_value = 21 |
|
74 | result = tested_object.should_continue(best_particle) |
|
75 | self.assertFalse(result) |
|
76 | ||
@@ 53-63 (lines=11) @@ | ||
50 | result = tested_object.should_continue(best_particle) |
|
51 | self.assertTrue(result) |
|
52 | ||
53 | def test_should_continue_false_enough_quality(self): |
|
54 | process, stages = self.get_basic_process() |
|
55 | tested_object = CreditCallsGroupOptimizationStrategy(stages, process) |
|
56 | tested_object.initialize() |
|
57 | best_particle = Mock() |
|
58 | stages[0].get_cost.return_value = 20 |
|
59 | stages[1].get_cost.return_value = 20 |
|
60 | stages[2].get_cost.return_value = 20 |
|
61 | best_particle.best_quality = 0.5 |
|
62 | result = tested_object.should_continue(best_particle) |
|
63 | self.assertFalse(result) |
|
64 | ||
65 | def test_should_continue_false_not_safe_cost(self): |
|
66 | process, stages = self.get_basic_process() |
|
@@ 41-51 (lines=11) @@ | ||
38 | with self.assertRaises(ValueError): |
|
39 | tested_object.initialize() |
|
40 | ||
41 | def test_should_continue_true(self): |
|
42 | process, stages = self.get_basic_process() |
|
43 | tested_object = CreditCallsGroupOptimizationStrategy(stages, process) |
|
44 | tested_object.initialize() |
|
45 | stages[0].get_cost.return_value = 20 |
|
46 | stages[1].get_cost.return_value = 20 |
|
47 | stages[2].get_cost.return_value = 20 |
|
48 | best_particle = Mock() |
|
49 | best_particle.best_quality = 2 |
|
50 | result = tested_object.should_continue(best_particle) |
|
51 | self.assertTrue(result) |
|
52 | ||
53 | def test_should_continue_false_enough_quality(self): |
|
54 | process, stages = self.get_basic_process() |