re_user_name = re.compile(r"^pub:.*:(.*)<.*$", re.MULTILINE);
re_re_mark = re.compile(r'^RE:')
-re_parse_lintian = re.compile(r"^(W|E|O): (.*?): (.*?) (.*)$")
+re_parse_lintian = re.compile(r"^(W|E|O): (.*?): ([^ ]*) ?(.*)$")
class re_parse_lintian(unittest.TestCase):
MATCH = regexes.re_parse_lintian.match
- def testSimple(self):
+ def testBinary(self):
+ self.assertEqual(
+ self.MATCH('W: pkgname: some-tag path/to/file').groups(),
+ ('W', 'pkgname', 'some-tag', 'path/to/file')
+ )
+
+ def testBinaryNoDescription(self):
+ self.assertEqual(
+ self.MATCH('W: pkgname: some-tag').groups(),
+ ('W', 'pkgname', 'some-tag', '')
+ )
+
+ def testSource(self):
+ self.assertEqual(
+ self.MATCH('W: pkgname source: some-tag').groups(),
+ ('W', 'pkgname source', 'some-tag', '')
+ )
+
+ def testSourceNoDescription(self):
self.assertEqual(
- self.MATCH('W: tzdata: binary-without-manpage usr/sbin/tzconfig').groups(),
- ('W', 'tzdata', 'binary-without-manpage', 'usr/sbin/tzconfig')
+ self.MATCH('W: pkgname source: some-tag path/to/file').groups(),
+ ('W', 'pkgname source', 'some-tag', 'path/to/file')
)
if __name__ == '__main__':