示例#1
0
 def test_star(self):
     condition = rules.starc(rules.rc(eq, 'pdk', 'name', 'c'))
     assert condition.evaluate(self.a1)
     assert not condition.evaluate(self.a2)
     assert not condition.evaluate(self.b1)
     assert not condition.evaluate(self.c)
     assert not condition.evaluate(None)
示例#2
0
 def test_star(self):
     condition = rules.starc(rules.rc(eq, 'pdk', 'name', 'c'))
     assert condition.evaluate(self.a1)
     assert not condition.evaluate(self.a2)
     assert not condition.evaluate(self.b1)
     assert not condition.evaluate(self.c)
     assert not condition.evaluate(None)
示例#3
0
 def test_star(self):
     actual = compile_debish('* apache | apache2', None, None)
     expected = starc(
         oc([
             ac([rc(eq, 'pdk', 'name', 'apache')]),
             ac([rc(eq, 'pdk', 'name', 'apache2')])
         ]))
     self.assert_equals(expected, actual)
示例#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
示例#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
示例#6
0
 def test_star(self):
     actual = compile_debish('* apache | apache2', None, None)
     expected = starc(oc([ac([rc(eq, 'pdk', 'name', 'apache')]),
                          ac([rc(eq, 'pdk', 'name', 'apache2')])]))
     self.assert_equals(expected, actual)