コード例 #1
0
 def test_non_match(self):
     """
     Check lines that shouldn't trigger any matches
     :return:
     """
     for line in self.non_matching:
         with self.subTest(line=line) if six.PY3 else Noop():
             extracted = extract_keypairs([line], self.regexer)
             self.assertEqual({}, extracted)
コード例 #2
0
    def test_match(self):
        """
        Check that for each specified line, a match is triggered

        n.b. a match must include the full length of the line, or nothing at all

        if it includes the full length of the line, there must be two named groups
        `KEY` and `VALUE` that contain only the key and value respectively

        :return:
        """
        for line in self.lines:
            with self.subTest(line=line) if six.PY3 else Noop():
                extracted = extract_keypairs([line], self.regexer)
                self.assertEqual({self.key: self.value}, extracted)
コード例 #3
0
 def test_non_match(self):
     for line in self.non_matching:
         with self.subTest(line=line) if six.PY3 else Noop():
             extracted = extract_keypairs([line], self.regexer)
             self.assertEqual({}, extracted)
コード例 #4
0
 def test_match(self):
     for line in self.lines:
         with self.subTest(line=line) if six.PY3 else Noop():
             extracted = extract_keypairs([line], self.regexer)
             self.assertEqual({self.key: self.value}, extracted)