コード例 #1
0
ファイル: test_chaptersidebar.py プロジェクト: nycz/lcars-tem
 def test_not_matching_regex_and_template(self):
     chapter_strings = [
         ['>> +CHAPTER (?P<foo>\\d+) ?[:-] (?P<bar>.+)', '{num} - {name}'],
         ['>> +CHAPTER (?P<num>\\d+)\\s*$', '{fishies}']
     ]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #2
0
ファイル: test_chaptersidebar.py プロジェクト: nycz/lcars-tem
 def test_empty_lists(self):
     chapter_strings = [
         [],
         ['>> +CHAPTER (?P<num>\\d+)\\s*$', '{num}']
     ]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #3
0
ファイル: test_chaptersidebar.py プロジェクト: nycz/lcars-tem
 def test_wrong_size_lists(self):
     chapter_strings = [
         ['>> +CHAPTER (?P<num>\\d+)\\s*$', '{num}', 'another one?'],
         ['>> +CHAPTER (?P<num>\\d+)\\s*$', '{num}']
     ]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #4
0
ファイル: test_chaptersidebar.py プロジェクト: nycz/lcars-tem
 def test_empty_string_data(self):
     chapter_strings = [
         ['   ', '{num} - {name}'],
         ['>> +CHAPTER (?P<num>\\d+)\\s*$', '']
     ]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #5
0
ファイル: test_chaptersidebar.py プロジェクト: nycz/lcars-tem
 def test_invalid_regex(self):
     chapter_strings = [
         ['>> +CHAPTER (?P<num>\\d+)) ?[:-] (?P<name>.+)', '{num} - {name}'],
         ['>> +CHAPTER (?P<num>\\d+)\\s*$', '{num}']
     ]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #6
0
 def test_wrong_size_lists(self):
     chapter_strings = [
         [">> +CHAPTER (?P<num>\\d+)\\s*$", "{num}", "another one?"],
         [">> +CHAPTER (?P<num>\\d+)\\s*$", "{num}"],
     ]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #7
0
ファイル: test_chaptersidebar.py プロジェクト: nycz/lcars-tem
 def test_nonstring_data(self):
     chapter_strings = [
         [12, 1555]
     ]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #8
0
ファイル: test_chaptersidebar.py プロジェクト: nycz/lcars-tem
 def test_valid_data(self):
     chapter_strings = [
         ['>> +CHAPTER (?P<num>\\d+) ?[:-] (?P<name>.+)', '{num} - {name}'],
         ['>> +CHAPTER (?P<num>\\d+)\\s*$', '{num}']
     ]
     self.assertIsNone(validate_chapter_strings(chapter_strings))
コード例 #9
0
 def test_empty_string_data(self):
     chapter_strings = [["   ", "{num} - {name}"], [">> +CHAPTER (?P<num>\\d+)\\s*$", ""]]
     with self.assertRaises(AssertionError):
         validate_chapter_strings(chapter_strings)
コード例 #10
0
 def test_valid_data(self):
     chapter_strings = [
         [">> +CHAPTER (?P<num>\\d+) ?[:-] (?P<name>.+)", "{num} - {name}"],
         [">> +CHAPTER (?P<num>\\d+)\\s*$", "{num}"],
     ]
     self.assertIsNone(validate_chapter_strings(chapter_strings))