def test_extract_progress(): # should pull out a number based on the supplied # regex and expression processor = ProcessController(r"^progress: (\d+)%$", None) assert processor._extract_progress('progress: 50%') == 50 processor = ProcessController(r"total: (\d+)%$", None) assert processor._extract_progress('my cool total: 100%') == 100
def test_extract_progress(self): # should pull out a number based on the supplied # regex and expression processor = ProcessController("^progress: (\d+)%$", None, 'utf-8') self.assertEqual(processor._extract_progress(b'progress: 50%'), 50) processor = ProcessController("total: (\d+)%$", None, 'utf-8') self.assertEqual(processor._extract_progress(b'my cool total: 100%'), 100)
def test_extract_progress(self): # should pull out a number based on the supplied # regex and expression processor = ProcessController(r"^progress: (\d+)%$", None, False, 'utf-8') self.assertEqual(processor._extract_progress(b'progress: 50%'), 50) processor = ProcessController(r"total: (\d+)%$", None, False, 'utf-8') self.assertEqual(processor._extract_progress(b'my cool total: 100%'), 100)
def test_extract_progress_returns_none_if_no_match_found(self): processor = ProcessController(r'(\d+)%$', None, 'utf-8') self.assertIsNone(processor._extract_progress(b'No match in dis string'))
def test_extract_progress_returns_none_if_no_regex_supplied(self): processor = ProcessController(None, None, 'utf-8') self.assertIsNone(processor._extract_progress(b'Total progress: 100%'))
def test_extract_progress_returns_none_if_no_match_found(): processor = ProcessController(r'(\d+)%$', None) assert processor._extract_progress('No match in dis string') == None
def test_extract_progress_returns_none_if_no_regex_supplied(): processor = ProcessController(None, None) assert processor._extract_progress('Total progress: 100%') == None
def test_extract_progress_returns_none_if_no_match_found(self): processor = ProcessController(r'(\d+)%$', None, False, 'utf-8') self.assertIsNone( processor._extract_progress(b'No match in dis string'))
def test_extract_progress_returns_none_if_no_regex_supplied(self): processor = ProcessController(None, None, False, 'utf-8') self.assertIsNone(processor._extract_progress(b'Total progress: 100%'))