def test_merging_interval_rule_with_larger_lt_continuous_rule(self):
     """Merging `0 < x < 3` and `x > 1` should produce `1 < x < 3`."""
     rule1 = IntervalRule('Rule', ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 3))
     rule2 = ContinuousRule('Rule', True, 1)
     new_rule = rule1.merge_with(rule2)
     self.assertIsInstance(new_rule, IntervalRule)
     self.assertEquals(new_rule.left_rule.value, 1)
 def test_merging_interval_rule_with_smaller_gt_continuous_rule(self):
     """Merging `0 < x < 3` and `x < 2` should produce `0 < x < 2`."""
     rule1 = IntervalRule('Rule', ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 3))
     rule2 = ContinuousRule('Rule', False, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertIsInstance(new_rule, IntervalRule)
     self.assertEquals(new_rule.right_rule.value, 2)
 def test_merging_interval_rules_with_larger_lt_component(self):
     """Merging `0 < x < 4` and `1 < x < 4` should produce `1 < x < 4`."""
     rule1 = IntervalRule('Rule', ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 4))
     rule2 = IntervalRule('Rule', ContinuousRule('Rule', True, 1),
                          ContinuousRule('Rule', False, 4))
     new_rule = rule1.merge_with(rule2)
     self.assertEquals(new_rule.left_rule.value, 1)
     self.assertEquals(new_rule.right_rule.value, 4)
 def test_merging_interval_rules_generally(self):
     """Merging `0 < x < 4` and `2 < x < 6` should produce `2 < x < 4`."""
     rule1 = IntervalRule('Rule', ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 4))
     rule2 = IntervalRule('Rule', ContinuousRule('Rule', True, 2),
                          ContinuousRule('Rule', False, 6))
     new_rule = rule1.merge_with(rule2)
     self.assertEquals(new_rule.left_rule.value, 2)
     self.assertEquals(new_rule.right_rule.value, 4)
Пример #5
0
 def test_merging_interval_rule_with_smaller_gt_continuous_rule(self):
     """Merging `0 < x < 3` and `x < 2` should produce `0 < x < 2`."""
     rule1 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 3))
     rule2 = ContinuousRule('Rule', False, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertIsInstance(new_rule, IntervalRule)
     self.assertEquals(new_rule.right_rule.value, 2)
Пример #6
0
 def test_merging_interval_rule_with_larger_lt_continuous_rule(self):
     """Merging `0 < x < 3` and `x > 1` should produce `1 < x < 3`."""
     rule1 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 3))
     rule2 = ContinuousRule('Rule', True, 1)
     new_rule = rule1.merge_with(rule2)
     self.assertIsInstance(new_rule, IntervalRule)
     self.assertEquals(new_rule.left_rule.value, 1)
Пример #7
0
 def test_merging_interval_rules_with_smaller_lt_component(self):
     """Merging `1 < x < 2` and `0 < x < 2` should produce `1 < x < 2`."""
     rule1 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 1),
                          ContinuousRule('Rule', False, 2))
     rule2 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 2))
     new_rule = rule1.merge_with(rule2)
     self.assertEquals(new_rule.left_rule.value, 1)
     self.assertEquals(new_rule.right_rule.value, 2)
Пример #8
0
 def test_merging_interval_rules_generally(self):
     """Merging `0 < x < 4` and `2 < x < 6` should produce `2 < x < 4`."""
     rule1 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 4))
     rule2 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 2),
                          ContinuousRule('Rule', False, 6))
     new_rule = rule1.merge_with(rule2)
     self.assertEquals(new_rule.left_rule.value, 2)
     self.assertEquals(new_rule.right_rule.value, 4)
Пример #9
0
 def test_merge_commutativity_on_interval_rules(self):
     rule1 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 4))
     rule2 = IntervalRule('Rule',
                          ContinuousRule('Rule', True, 2),
                          ContinuousRule('Rule', False, 6))
     new_rule1 = rule1.merge_with(rule2)
     new_rule2 = rule2.merge_with(rule1)
     self.assertEquals(new_rule1.left_rule.value,
                       new_rule2.left_rule.value)
     self.assertEquals(new_rule1.right_rule.value,
                       new_rule2.right_rule.value)
 def test_merge_commutativity_on_interval_rules(self):
     rule1 = IntervalRule('Rule', ContinuousRule('Rule', True, 0),
                          ContinuousRule('Rule', False, 4))
     rule2 = IntervalRule('Rule', ContinuousRule('Rule', True, 2),
                          ContinuousRule('Rule', False, 6))
     new_rule1 = rule1.merge_with(rule2)
     new_rule2 = rule2.merge_with(rule1)
     self.assertEquals(new_rule1.left_rule.value, new_rule2.left_rule.value)
     self.assertEquals(new_rule1.right_rule.value,
                       new_rule2.right_rule.value)