Example #1
0
 def test_star2(self):
     actual = compile_debish('** apache | apache2', None, None)
     expected = star2c(
         oc([
             ac([rc(eq, 'pdk', 'name', 'apache')]),
             ac([rc(eq, 'pdk', 'name', 'apache2')])
         ]))
     self.assert_equals(expected, actual)
Example #2
0
 def test_star2(self):
     condition = rules.star2c(rules.rc(eq, 'pdk', 'name', 'c'))
     assert condition.evaluate(self.a1)
     assert not condition.evaluate(self.a2)
     assert not condition.evaluate(self.b1)
     assert condition.evaluate(self.c)
     assert not condition.evaluate(self.d)
     assert not condition.evaluate(None)
Example #3
0
 def test_star2(self):
     condition = rules.star2c(rules.rc(eq, 'pdk', 'name', 'c'))
     assert condition.evaluate(self.a1)
     assert not condition.evaluate(self.a2)
     assert not condition.evaluate(self.b1)
     assert condition.evaluate(self.c)
     assert not condition.evaluate(self.d)
     assert not condition.evaluate(None)
Example #4
0
    def parse_star(self, lex):
        token_type, dummy = lex.peek()
        if token_type == '*':
            self.assert_type(lex, '*')
            token_type, dummy = lex.peek()
            if token_type == '*':
                self.assert_type(lex, '*')
                star = 2
            else:
                star = 1
        else:
            star = 0

        condition = self.wrap_condition(self.parse_or(lex))

        # here is where we plug in the blob_id and package_type
        if star == 1:
            return starc(condition)
        elif star == 2:
            return star2c(condition)
        else:
            return condition
Example #5
0
    def parse_star(self, lex):
        token_type, dummy = lex.peek()
        if token_type == '*':
            self.assert_type(lex, '*')
            token_type, dummy = lex.peek()
            if token_type == '*':
                self.assert_type(lex, '*')
                star = 2
            else:
                star = 1
        else:
            star = 0

        condition = self.wrap_condition(self.parse_or(lex))

        # here is where we plug in the blob_id and package_type
        if star == 1:
            return starc(condition)
        elif star == 2:
            return star2c(condition)
        else:
            return condition
Example #6
0
 def test_star2(self):
     actual = compile_debish('** apache | apache2', None, None)
     expected = star2c(oc([ac([rc(eq, 'pdk', 'name', 'apache')]),
                          ac([rc(eq, 'pdk', 'name', 'apache2')])]))
     self.assert_equals(expected, actual)