def test_repr(self):
     config = {
         'progress': 0.5,
         'message': 'dummy',
         'severity': ''
     }
     expected = 'Progress[progress:0.5, message:dummy, severity:]'
     test_line_matcher = line_matcher.Progress(**config)
     self.assertEqual(expected, test_line_matcher.__repr__())
 def test_wrong_message(self):
     line = 'abc'
     progress = line_matcher.Progress(
         progress=1, message='a', severity=' ')
     test_wrong_message = {
         'pattern': r'.*.',
         'message_template': 'Installing %(package)s'
     }
     matcher = line_matcher.LineMatcher(
         **test_wrong_message)
     self.assertRaises(
         KeyError,
         matcher.update_progress,
         line=line,
         progress=progress)
 def test_regex_match(self):
     line = 'abc'
     regex_ = r'^a'
     progress = line_matcher.Progress(
         progress=1, message='a', severity=' ')
     test_regex_match = {
         'pattern': regex_,
         'unmatch_sameline_next_matcher_name': 'usn',
         'unmatch_nextline_next_matcher_name': 'unn',
         'match_sameline_next_matcher_name': 'msn',
         'match_nextline_next_matcher_name': 'mnn',
     }
     matcher = line_matcher.LineMatcher(
         **test_regex_match)
     expected = ('msn', 'mnn')
     self.assertEqual(
         expected,
         matcher.update_progress(
             line, progress))
 def _mock_progress(self):
     self.progress = line_matcher.Progress(
         progress=0.5,
         message='',
         severity='')