Ejemplo n.º 1
0
 def test_rule_txt_with_three_rules(self):
     txt_rule = "L1>=20\n" \
                "L2=3\n" \
                "W<=90".splitlines()
     exp_result = [("L1", ">=", 20),
                   ("L2", "=", 3),
                   ("W", "<=", 90)]
     self.assertEqual(exp_result, Rule.parse(txt_rule))
Ejemplo n.º 2
0
    def test_W_03(self):
        txt_rule = "L1>0\n" \
                   "L1<10\n" \
                   "L2>0\n" \
                   "L2<10\n" \
                   "W==90".splitlines()
        rules = Rule.parse(txt_rule)

        Equation.validate_rules_for_w(rules)
Ejemplo n.º 3
0
    def test_W_03(self):
        txt_rule = "L1>0\n" \
                   "L1<10\n" \
                   "L2>0\n" \
                   "L2<10\n" \
                   "W==90".splitlines()
        rules = Rule.parse(txt_rule)

        Equation.validate_rules_for_w(rules)
Ejemplo n.º 4
0
    def test_W_01(self):
        txt_rule = "L1>0\n" \
                   "L1<10\n" \
                   "L2>0\n" \
                   "L2<10\n" \
                   "W<=90".splitlines()
        rules = Rule.parse(txt_rule)

        exceptions = (RuleException)
        with self.assertRaises(exceptions):
            Equation.validate_rules_for_w(rules)
Ejemplo n.º 5
0
    def test_W_01(self):
        txt_rule = "L1>0\n" \
                   "L1<10\n" \
                   "L2>0\n" \
                   "L2<10\n" \
                   "W<=90".splitlines()
        rules = Rule.parse(txt_rule)

        exceptions = (RuleException)
        with self.assertRaises(exceptions):
            Equation.validate_rules_for_w(rules)
Ejemplo n.º 6
0
 def test_rule_txt_as_none(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         Rule.parse(None)
Ejemplo n.º 7
0
 def test_rule_txt_with_missing_value(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "L1>=".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 8
0
 def test_rule_txt_with_invalid_value_02(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "L1>=10.6".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 9
0
 def test_rule_txt_with_invalid_operand_02(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "L1<>20".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 10
0
 def test_rule_txt_with_missing_element(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = " >=20".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 11
0
 def test_rule_txt_with_invalid_element_02(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "12>=20".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 12
0
 def test_rule_txt_with_invalid_value_02(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "L1>=10.6".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 13
0
 def test_rule_txt_with_missing_element(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = " >=20".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 14
0
 def test_rule_txt_with_one_rule_and_spaces(self):
     txt_rule = "L1 >= 20".splitlines()
     exp_result = [("L1", ">=", 20)]
     self.assertEqual(exp_result, Rule.parse(txt_rule))
Ejemplo n.º 15
0
 def test_rule_txt_with_one_rule_and_spaces(self):
     txt_rule = "L1 >= 20".splitlines()
     exp_result = [("L1", ">=", 20)]
     self.assertEqual(exp_result, Rule.parse(txt_rule))
Ejemplo n.º 16
0
 def test_rule_txt_with_three_rules(self):
     txt_rule = "L1>=20\n" \
                "L2=3\n" \
                "W<=90".splitlines()
     exp_result = [("L1", ">=", 20), ("L2", "=", 3), ("W", "<=", 90)]
     self.assertEqual(exp_result, Rule.parse(txt_rule))
Ejemplo n.º 17
0
 def test_rule_txt_with_two_rules(self):
     txt_rule = "L1>=20\n" \
                "L2=3".splitlines()
     exp_result = [("L1", ">=", 20), ("L2", "=", 3)]
     self.assertEqual(exp_result, Rule.parse(txt_rule))
Ejemplo n.º 18
0
 def test_rule_txt_with_missing_value(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "L1>=".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 19
0
 def test_rule_txt_as_none(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         Rule.parse(None)
Ejemplo n.º 20
0
 def test_rule_txt_with_two_rules(self):
     txt_rule = "L1>=20\n" \
                "L2=3".splitlines()
     exp_result = [("L1", ">=", 20),
                   ("L2", "=", 3)]
     self.assertEqual(exp_result, Rule.parse(txt_rule))
Ejemplo n.º 21
0
 def test_rule_txt_with_invalid_element_02(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "12>=20".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 22
0
 def test_rule_txt_with_invalid_operand_02(self):
     exceptions = (RuleException)
     with self.assertRaises(exceptions):
         txt_rule = "L1<>20".splitlines()
         Rule.parse(txt_rule)
Ejemplo n.º 23
0
 def test_rule_txt_as_empty_string(self):
     exceptions = (RuleException)
     self.assertEqual([], Rule.parse(""))
Ejemplo n.º 24
0
 def test_rule_txt_as_empty_string(self):
     exceptions = (RuleException)
     self.assertEqual([], Rule.parse(""))