Beispiel #1
0
 def test_eval_progress_returns_none_on_failure(self):
     # given a match in the string, should eval the result
     regex = r'(\d+)/(\d+)$'
     processor = ProcessController(regex, r'x[0] *^/* x[1]', 'utf-8')
     match = re.search(regex, '50/50')
     self.assertIsNone(processor._eval_progress(match))
Beispiel #2
0
 def test_eval_progress(self):
     # given a match in the string, should eval the result
     regex = r'(\d+)/(\d+)$'
     processor = ProcessController(regex, r'x[0] / x[1]', 'utf-8')
     match = re.search(regex, '50/50')
     self.assertEqual(processor._eval_progress(match), 1.0)
Beispiel #3
0
def test_eval_progress_returns_none_on_failure():
  # given a match in the string, should eval the result
  regex = r'(\d+)/(\d+)$'
  processor = ProcessController(regex, r'x[0] *^/* x[1]')
  match = re.search(regex, '50/50')
  assert processor._eval_progress(match) == None
Beispiel #4
0
def test_eval_progress():
  # given a match in the string, should eval the result
  regex = r'(\d+)/(\d+)$'
  processor = ProcessController(regex, r'x[0] / x[1]')
  match = re.search(regex, '50/50')
  assert processor._eval_progress(match) == 1.0
Beispiel #5
0
 def test_eval_progress_returns_none_on_failure(self):
     # given a match in the string, should eval the result
     regex = r'(\d+)/(\d+)$'
     processor = ProcessController(regex, r'x[0] *^/* x[1]', False, 'utf-8')
     match = re.search(regex, '50/50')
     self.assertIsNone(processor._eval_progress(match))
Beispiel #6
0
 def test_eval_progress(self):
     # given a match in the string, should eval the result
     regex = r'(\d+)/(\d+)$'
     processor = ProcessController(regex, r'x[0] / x[1]', False, 'utf-8')
     match = re.search(regex, '50/50')
     self.assertEqual(processor._eval_progress(match), 1.0)