コード例 #1
0
ファイル: test_rules.py プロジェクト: 675801717/orange3
 def test_merge_commutativity_on_continuous_rules(self):
     """Continuous rule merging should be commutative."""
     rule1 = ContinuousRule('Rule1', True, 1)
     rule2 = ContinuousRule('Rule1', True, 2)
     new_rule1 = rule1.merge_with(rule2)
     new_rule2 = rule2.merge_with(rule1)
     self.assertEqual(new_rule1.value, new_rule2.value)
コード例 #2
0
 def test_merge_commutativity_on_continuous_rules(self):
     """Continuous rule merging should be commutative."""
     rule1 = ContinuousRule("Rule1", True, 1)
     rule2 = ContinuousRule("Rule1", True, 2)
     new_rule1 = rule1.merge_with(rule2)
     new_rule2 = rule2.merge_with(rule1)
     self.assertEqual(new_rule1.value, new_rule2.value)
コード例 #3
0
 def test_merging_lt_with_gt_continuous_rules(self):
     """Merging `x > 1` and `x < 2` should produce `1 < x < 2`."""
     rule1 = ContinuousRule("Rule", True, 1)
     rule2 = ContinuousRule("Rule", False, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertIsInstance(new_rule, IntervalRule)
     self.assertEqual(new_rule.left_rule, rule1)
     self.assertEqual(new_rule.right_rule, rule2)
コード例 #4
0
ファイル: test_rules.py プロジェクト: 675801717/orange3
 def test_merging_lt_with_gt_continuous_rules(self):
     """Merging `x > 1` and `x < 2` should produce `1 < x < 2`."""
     rule1 = ContinuousRule('Rule', True, 1)
     rule2 = ContinuousRule('Rule', False, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertIsInstance(new_rule, IntervalRule)
     self.assertEqual(new_rule.left_rule, rule1)
     self.assertEqual(new_rule.right_rule, rule2)
コード例 #5
0
 def test_merging_lt_with_lte_rule(self):
     """Merging `x < 1` and `x ≤ 1` should produce `x < 1`."""
     rule1 = ContinuousRule("Rule", False, 1, inclusive=True)
     rule2 = ContinuousRule("Rule", False, 1, inclusive=False)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.inclusive, False)
コード例 #6
0
 def test_merging_two_lt_continuous_rules(self):
     """Merging `x < 1` and `x < 2` should produce `x < 1`."""
     rule1 = ContinuousRule("Rule", False, 1)
     rule2 = ContinuousRule("Rule", False, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.value, 1)
コード例 #7
0
 def test_merge_keeps_attr_name_on_continuous_rules(self):
     """Merging continuous rules should keep the name of the rule."""
     rule1 = ContinuousRule("Rule1", True, 1)
     rule2 = ContinuousRule("Rule1", True, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.attr_name, "Rule1")
コード例 #8
0
 def test_merge_keeps_gt_on_continuous_rules(self):
     """Merging ccontinuous rules should keep GT property."""
     rule1 = ContinuousRule("Rule1", True, 1)
     rule2 = ContinuousRule("Rule1", True, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.greater, True)
コード例 #9
0
ファイル: test_rules.py プロジェクト: 675801717/orange3
 def test_merging_lt_with_lte_rule(self):
     """Merging `x < 1` and `x ≤ 1` should produce `x < 1`."""
     rule1 = ContinuousRule('Rule', False, 1, inclusive=True)
     rule2 = ContinuousRule('Rule', False, 1, inclusive=False)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.inclusive, False)
コード例 #10
0
ファイル: test_rules.py プロジェクト: 675801717/orange3
 def test_merging_two_lt_continuous_rules(self):
     """Merging `x < 1` and `x < 2` should produce `x < 1`."""
     rule1 = ContinuousRule('Rule', False, 1)
     rule2 = ContinuousRule('Rule', False, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.value, 1)
コード例 #11
0
 def test_merging_gt_with_gte_continuous_rule(self):
     """Merging `x > 1` and `x ≥ 1` should produce `x > 1`."""
     rule1 = ContinuousRule('Rule', True, 1, inclusive=True)
     rule2 = ContinuousRule('Rule', True, 1, inclusive=False)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.inclusive, False)
コード例 #12
0
 def test_merging_two_gt_continuous_rules(self):
     """Merging `x > 1` and `x > 2` should produce `x > 2`."""
     rule1 = ContinuousRule('Rule', True, 1)
     rule2 = ContinuousRule('Rule', True, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.value, 2)
コード例 #13
0
ファイル: test_rules.py プロジェクト: 675801717/orange3
 def test_merge_keeps_attr_name_on_continuous_rules(self):
     """Merging continuous rules should keep the name of the rule."""
     rule1 = ContinuousRule('Rule1', True, 1)
     rule2 = ContinuousRule('Rule1', True, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.attr_name, 'Rule1')
コード例 #14
0
ファイル: test_rules.py プロジェクト: 675801717/orange3
 def test_merge_keeps_gt_on_continuous_rules(self):
     """Merging ccontinuous rules should keep GT property."""
     rule1 = ContinuousRule('Rule1', True, 1)
     rule2 = ContinuousRule('Rule1', True, 2)
     new_rule = rule1.merge_with(rule2)
     self.assertEqual(new_rule.greater, True)