Пример #1
0
 def test_no_match_sequence_not_at_end(self):
     """Test REGEX_FILE_COUNTER no match: sequence must be before extention"""
     test_str = "hello_3.x_x.txt"
     matches = REGEX_FILE_COUNTER.findall(test_str)
     self.assertFalse(matches)
Пример #2
0
 def test_no_match_missing_sequence(self):
     """Test REGEX_FILE_COUNTER no match: missing sequence"""
     test_str = "file.txt"
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertFalse(matches)
Пример #3
0
 def test_no_match_invalid_sequence(self):
     """Test REGEX_FILE_COUNTER no match: invalid sequence"""
     test_str = "file1.txt"
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertFalse(matches)
Пример #4
0
 def test_sequence_numeric_ext_with_underscore(self):
     """ Test REGEX_FILE_COUNTER numeric extention with underscore"""
     test_str = "hello_3._123"
     matches = REGEX_FILE_COUNTER.findall(test_str)
     self.assertEqual(len(matches), 1)
     self.assertEqual(matches, ['3',])
Пример #5
0
 def test_no_match_invlaid_extention(self):
     """Test REGEX_FILE_COUNTER no match: invalid extention"""
     test_str = "_1."
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertFalse(matches)
Пример #6
0
 def test_sequence_repeated(self):
     """ Test REGEX_FILE_COUNTER repeated in sequence"""
     test_str = "hello_1._3.txt"
     matches = REGEX_FILE_COUNTER.findall(test_str)
     self.assertEqual(len(matches), 1)
     self.assertEqual(matches, ['3',])
Пример #7
0
 def test_sequence_underscore_ext(self):
     """ Test REGEX_FILE_COUNTER extention with underscore"""
     test_str = "hello_3._txt"
     matches = REGEX_FILE_COUNTER.findall(test_str)
     self.assertEqual(len(matches), 1)
     self.assertEqual(matches, ['3',])
Пример #8
0
 def test_sequence_simple(self):
     """ Test REGEX_FILE_COUNTER simplest valid sequence"""
     test_str = "_1.txt"
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertTrue(matches)
     self.assertEqual(matches.group('i'), '1')
Пример #9
0
 def test_valid_numeric_matches_four_digit(self):
     """ Test REGEX_FILE_COUNTER valid numeric match 4 digits"""
     test_str = "file_1024.txt"
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertTrue(matches)
     self.assertEqual(matches.group('i'), '1024')
Пример #10
0
 def test_valid_numeric_matches_three_digit(self):
     """ Test REGEX_FILE_COUNTER valid numeric match 3 digits"""
     test_str = "file_256.txt"
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertTrue(matches)
     self.assertEqual(matches.group('i'), '256')
Пример #11
0
 def test_valid_numeric_matches_single_digit(self):
     """ Test REGEX_FILE_COUNTER valid numeric match 1 digit"""
     test_str = "file_8.txt"
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertTrue(matches)
     self.assertEqual(matches.group('i'), '8')
Пример #12
0
 def test_valid_numeric_matches_zero(self):
     """ Test REGEX_FILE_COUNTER valid numeric match 0"""
     test_str = "file_0.txt"
     matches = REGEX_FILE_COUNTER.search(test_str)
     self.assertTrue(matches)
     self.assertEqual(matches.group('i'), '0')