def test_execute_script(self): assert execute_script(['-r', r'\d{3}', '-p', self.test_dir]) == 'In file named "text1.txt" there were following occurrence: 123 \n' \ 'In file named "text2.txt" there were following occurrence: 456 \n' \ 'In file named "text2.txt" there were following occurrence: 789 \n' \ 'In file named "text3.txt" there were following occurrence: 666 \n' \ 'In file named "text3.txt" there were following occurrence: 997 \n'
def test_execute_script(self): self.assertEqual( 'In file named "text1.txt" there were following occurrence: 123 \n' 'In file named "text2.txt" there were following occurrence: 456 \n' 'In file named "text2.txt" there were following occurrence: 789 \n' 'In file named "text3.txt" there were following occurrence: 666 \n' 'In file named "text3.txt" there were following occurrence: 997 \n', execute_script(['-r', r'\d{3}']))
def test_verbosity_deactivation(self): # default verbosity => lvl 0 => no messages execute_script([ '-r', r'\d{3}', '-p', self.test_dir, '-n', 'regex_search_log_1.txt' ]) with open(os.path.join(self.test_dir, 'regex_search_log_1.txt'), 'r') as f: assert f.read() == "" # verbosity lvl 1 => messages are errors and critical execute_script([ '-r', r'\d{3}', '-p', self.test_dir, '-v', '1', '-n', 'regex_search_log_2.txt' ]) with open(os.path.join(self.test_dir, 'regex_search_log_2.txt'), 'r') as f: assert f.read() == "ERROR - Following file has a visible ERROR messages\n" \ "CRITICAL - Following file has a visible CRITICAL messages\n"
def test_execute_script(self): assert execute_script(['-r', r'\d{3}']) == ''
def test_execute_script(self): assert execute_script(['-r', r'\d{3}', '-p', self.test_dir]) == ''
def test_execute_script(self): self.assertEqual('', execute_script(['-r', r'\d{3}']))
def test_execute_script(self): self.assertEqual('', execute_script(['-r', r'\d{3}', '-p', self.test_dir]))