示例#1
0
    def test_assert_error(self):
        try:
            compile_debish('apache )', None, None)
            self.fail('error should happen on invalid expressions')
        except InputError, error:
            message = str(error)
            expected_message = '''apache >>>)
Expected end, got ) at character 7'''
            self.assert_equals(expected_message, message)
示例#2
0
    def test_assert_error(self):
        try:
            compile_debish('apache )', None, None)
            self.fail('error should happen on invalid expressions')
        except InputError, error:
            message = str(error)
            expected_message = '''apache >>>)
Expected end, got ) at character 7'''
            self.assert_equals(expected_message, message)
示例#3
0
 def test_or(self):
     actual = compile_debish('apache | apache2', None, None)
     expected = oc([
         ac([rc(eq, 'pdk', 'name', 'apache')]),
         ac([rc(eq, 'pdk', 'name', 'apache2')])
     ])
     self.assert_equals(expected, actual)
示例#4
0
 def test_name_version(self):
     actual = compile_debish('apache (=2.0-1)', deb, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache'),
                    rc(eq, 'pdk', 'version', DebianVersion('2.0-1'))])
     wrapper = ac([expected,
                   rc(eq, 'pdk', 'type', 'deb')])
     self.assert_equals(wrapper, actual)
示例#5
0
 def test_untyped_version(self):
     actual = compile_debish('apache (=2.0-1)', None, None)
     expected = ac([
         rc(eq, 'pdk', 'name', 'apache'),
         rc(eq, 'pdk', 'version', '2.0-1')
     ])
     self.assert_equals(expected, actual)
示例#6
0
 def test_term_with_blob_id(self):
     actual = compile_debish('apache (=2.0-1)', deb, 'sha-1:aaa')
     expected = ac([rc(eq, 'pdk', 'name', 'apache'),
                    rc(eq, 'pdk', 'version', DebianVersion('2.0-1'))])
     wrapper = ac([rc(eq, 'pdk', 'blob-id', 'sha-1:aaa'),
                   expected,
                   rc(eq, 'pdk', 'type', 'deb')])
     self.assert_equals(wrapper, actual)
示例#7
0
 def test_not_arch(self):
     actual = compile_debish('apache [!i386 !amd64]', deb, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache'),
                    notc(oc([rc(eq, 'deb', 'arch', 'i386'),
                             rc(eq, 'deb', 'arch', 'amd64')]))])
     wrapper = ac([expected,
                   rc(eq, 'pdk', 'type', 'deb')])
     self.assert_equals(wrapper, actual)
示例#8
0
 def test_name_version(self):
     actual = compile_debish('apache (=2.0-1)', deb, None)
     expected = ac([
         rc(eq, 'pdk', 'name', 'apache'),
         rc(eq, 'pdk', 'version', DebianVersion('2.0-1'))
     ])
     wrapper = ac([expected, rc(eq, 'pdk', 'type', 'deb')])
     self.assert_equals(wrapper, actual)
示例#9
0
 def test_name_arch(self):
     actual = compile_debish('apache [i386 amd64]', deb, None)
     expected = ac([
         rc(eq, 'pdk', 'name', 'apache'),
         oc([rc(eq, 'deb', 'arch', 'i386'),
             rc(eq, 'deb', 'arch', 'amd64')])
     ])
     wrapper = ac([expected, rc(eq, 'pdk', 'type', 'deb')])
     self.assert_equals(wrapper, actual)
示例#10
0
 def test_name_other(self):
     actual = compile_debish('apache {a:b = c dd:ee>=fgh i=j}', deb,
                             None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache'),
                    ac([rc(eq, 'a', 'b', 'c'),
                        rc(ge, 'dd', 'ee', 'fgh'),
                        rc(eq, 'pdk', 'i', 'j')])])
     wrapper = ac([expected,
                   rc(eq, 'pdk', 'type', 'deb')])
     self.assert_equals(wrapper, actual)
示例#11
0
 def test_term_with_blob_id(self):
     actual = compile_debish('apache (=2.0-1)', deb, 'sha-1:aaa')
     expected = ac([
         rc(eq, 'pdk', 'name', 'apache'),
         rc(eq, 'pdk', 'version', DebianVersion('2.0-1'))
     ])
     wrapper = ac([
         rc(eq, 'pdk', 'blob-id', 'sha-1:aaa'), expected,
         rc(eq, 'pdk', 'type', 'deb')
     ])
     self.assert_equals(wrapper, actual)
示例#12
0
 def test_name_other(self):
     actual = compile_debish('apache {a:b = c dd:ee>=fgh i=j}', deb, None)
     expected = ac([
         rc(eq, 'pdk', 'name', 'apache'),
         ac([
             rc(eq, 'a', 'b', 'c'),
             rc(ge, 'dd', 'ee', 'fgh'),
             rc(eq, 'pdk', 'i', 'j')
         ])
     ])
     wrapper = ac([expected, rc(eq, 'pdk', 'type', 'deb')])
     self.assert_equals(wrapper, actual)
示例#13
0
 def test_name_only(self):
     actual = compile_debish('apache', None, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache')])
     self.assert_equals(expected, actual)
示例#14
0
 def test_marked_condition(self):
     debish = 'apache (=3) [i386]'
     condition = compile_debish(debish, deb, None)
     self.assert_equals(debish, condition.debish)
示例#15
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)
示例#16
0
 def test_build_general_debish_ref(self):
     actual = compile_debish('apache', src, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache')])
     wrapper = ac([expected, rc(eq, 'pdk', 'role', 'source')])
     self.assert_equals(wrapper, actual)
示例#17
0
 def test_build_general_debish_ref(self):
     actual = compile_debish('apache', src, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache')])
     wrapper = ac([expected,
                   rc(eq, 'pdk', 'role', 'source')])
     self.assert_equals(wrapper, actual)
示例#18
0
 def test_relaxed_relation(self):
     actual = compile_debish('apache {a:b %= c}', None, None)
     expected = ac(
         [rc(eq, 'pdk', 'name', 'apache'),
          ac([relrc(eq, 'a', 'b', 'c')])])
     self.assert_equals(expected, actual)
示例#19
0
 def test_relaxed_relation(self):
     actual = compile_debish('apache {a:b %= c}', None, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache'),
                    ac([relrc(eq, 'a', 'b', 'c')])])
     self.assert_equals(expected, actual)
示例#20
0
 def test_untyped_version(self):
     actual = compile_debish('apache (=2.0-1)', None, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache'),
                    rc(eq, 'pdk', 'version', '2.0-1')])
     self.assert_equals(expected, actual)
示例#21
0
 def test_marked_condition(self):
     debish = 'apache (=3) [i386]'
     condition = compile_debish(debish, deb, None)
     self.assert_equals(debish, condition.debish)
示例#22
0
 def test_name_only(self):
     actual = compile_debish('apache', None, None)
     expected = ac([rc(eq, 'pdk', 'name', 'apache')])
     self.assert_equals(expected, actual)