示例#1
0
 def test_manupaper_numbers_of(self):
     data = [
         # (lines, rows, expect[float])
         (True, 40, 20, 2),
         (True, 50, 20, 2.5),
         (True, 50, 0, 0),
     ]
     validate_with_fail(
         self, 'manupaper_numbers_of',
         lambda lines, rows, expect: self.assertEqual(
             cnt.Counter().manupaper_numbers_of(lines, rows), expect), data)
示例#2
0
 def test_scenes_of(self):
     data = [
         # (src, expect[int])
         (True, Story('a', Chapter('b', Episode('c', Scene('d', )))), 1),
         (True, Chapter('a', Episode('b', Scene('c', ))), 1),
         (True, Episode('a', Scene('b', )), 1),
         (True, Scene('a', ), 1),
         (True, SCode(None, SCmd.BE, (), ''), 0),
     ]
     validate_with_fail(
         self, 'scenes_of', lambda src, expect: self.assertEqual(
             cnt.Counter().scenes_of(src), expect), data)
示例#3
0
 def test_scodes_of_without_info(self):
     scode0 = SCode(None, SCmd.BE, (), '')
     sinfo = SCode(None, SCmd.INFO_DATA, (), '')
     data = [
         # (src, expect[int])
         (True,
          Story('a', Chapter('b', Episode('c', Scene('d', scode0,
                                                     sinfo)))), 1),
         (True, Chapter('a', Episode('b', Scene('c', scode0, sinfo))), 1),
         (True, Episode('a', Scene('b', scode0, sinfo)), 1),
         (True, Scene('a', scode0, sinfo), 1),
         (True, scode0, 1),
         (True, sinfo, 0),
     ]
     validate_with_fail(
         self, 'scode_of_without_info',
         lambda src, expect: self.assertEqual(
             cnt.Counter().scodes_of_without_info(src), expect), data)
示例#4
0
 def test_description_characters_of(self):
     scode0 = SCode(None, SCmd.BE, ('apple', ), '')
     scode1 = SCode(None, SCmd.DO, ('orange', ), '')
     sinfo = SCode(None, SCmd.INFO_DATA, ('test', ), '')
     data = [
         # (src, expect[int])
         (True,
          Story(
              'a',
              Chapter('b', Episode('c', Scene('d', scode0, scode1,
                                              sinfo)))), 13),
         (True, Chapter('a', Episode('b', Scene('c', scode0, scode1,
                                                sinfo))), 13),
         (True, Episode('a', Scene('b', scode0, scode1, sinfo)), 13),
         (True, Scene('a', scode0, scode1, sinfo), 13),
         (True, scode0, 6),
         (True, sinfo, 0),
         (True, [scode0, scode1], 13),
     ]
     validate_with_fail(
         self, 'description_characters_of',
         lambda src, expect: self.assertEqual(
             cnt.Counter().description_characters_of(src), expect), data)
示例#5
0
 def test_manupaper_rows_of(self):
     scode0 = SCode(None, SCmd.BE, ('apple', ), '')
     scode1 = SCode(None, SCmd.DO, ('orange', ), '')
     scode2 = SCode(None, SCmd.TALK, ('melon', ), '')
     data = [
         # (src, columns, expect[int])
         (True,
          Story(
              'a',
              Chapter('b', Episode('c', Scene('d', scode0, scode1,
                                              scode2)))), 20, 3),
         (True,
          Chapter('a', Episode('b', Scene('c', scode0, scode1,
                                          scode2))), 20, 3),
         (True, Episode('a', Scene('b', scode0, scode1, scode2)), 20, 3),
         (True, Scene('a', scode0, scode1, scode2), 20, 3),
         (True, scode0, 20, 1),
         (True, [scode0, scode1, scode2], 20, 3),
         (True, SCode(None, SCmd.DO, ('a' * 10, )), 5, 3),
     ]
     validate_with_fail(
         self, 'manupaper_rows_of',
         lambda src, columns, expect: self.assertEqual(
             cnt.Counter().manupaper_rows_of(src, columns), expect), data)