예제 #1
0
 def test_multi_element_list__no_content(self):
     items = [header_only_item('header 1'), header_only_item('header 2')]
     formatter = formatter_with_page_width(20)
     actual = formatter.format_header_value_list_according_to_format(
         items, self.list_format)
     self.assertEqual(
         ['1. header 1', BLANK_LINE, BLANK_LINE, '2. header 2'], actual)
예제 #2
0
파일: lists.py 프로젝트: emilkarlen/exactly
 def test_multi_element_list(self):
     items = [header_only_item('header 1'),
              header_only_item('header 2')]
     formatter = formatter_with_page_width(20)
     actual = formatter.format_header_value_list_according_to_format(items,
                                                                     list_formatter_with_no_blank_lines)
     self.assertEqual(['1. header 1',
                       '2. header 2'],
                      actual)
예제 #3
0
파일: lists.py 프로젝트: emilkarlen/exactly
 def test_multi_element_list(self):
     formatter = formatter_with_page_width(5)
     items = [header_only_item('45 4'),
              header_only_item('ab c')]
     actual = formatter.format_header_value_list_according_to_format(items,
                                                                     list_formatter_with_no_blank_lines)
     self.assertEqual(['1. 45',
                       '   4',
                       '2. ab',
                       '   c'],
                      actual)
예제 #4
0
파일: lists.py 프로젝트: emilkarlen/exactly
 def test_multi_element_list__no_content(self):
     items = [header_only_item('header 1'),
              header_only_item('header 2')]
     formatter = formatter_with_page_width(20)
     actual = formatter.format_header_value_list_according_to_format(items,
                                                                     self.list_format)
     self.assertEqual(['1. header 1',
                       BLANK_LINE,
                       BLANK_LINE,
                       '2. header 2'],
                      actual)
예제 #5
0
 def test_varying_header_following_line_indent(self):
     formatter = formatter_with_page_width(4)
     items = [
         header_only_item('h1 X'),
         header_only_item('h2 Y'),
         header_only_item('h3 Z')
     ]
     list_format = lf.ListFormat(
         HeaderFormatWithVaryingFollowingLineIndent(3),
         NO_SEPARATIONS,
         indent_str='')
     actual = formatter.format_header_value_list_according_to_format(
         items, list_format)
     self.assertEqual(['**h1', '  X', '*h2', ' Y', '**h3', '  Z'], actual)
예제 #6
0
    def test_without_content(self):
        formatter = formatter_with_page_width(4)
        current_indent_before = formatter.wrapper.current_indent
        indent_stack_before = formatter.wrapper.saved_indents_stack.copy()
        items = [header_only_item('h1 X'), header_only_item('h2 Y')]
        list_format = lf.ListFormat(
            HeaderFormatWithVaryingFollowingLineIndent(3), NO_SEPARATIONS)
        formatter.format_header_value_list_according_to_format(
            items, list_format)
        self.assertEqual(current_indent_before,
                         formatter.wrapper.current_indent, 'Current indent')

        self.assertEqual(indent_stack_before,
                         formatter.wrapper.saved_indents_stack,
                         'Saved indents stack')
예제 #7
0
파일: lists.py 프로젝트: emilkarlen/exactly
 def test_singleton_list(self):
     items = [header_only_item('header')]
     formatter = formatter_with_page_width(10)
     actual = formatter.format_header_value_list_according_to_format(items,
                                                                     list_formatter_with_no_blank_lines)
     self.assertEqual(['1. header'],
                      actual)
예제 #8
0
파일: lists.py 프로젝트: emilkarlen/exactly
    def test_without_content(self):
        formatter = formatter_with_page_width(4)
        current_indent_before = formatter.wrapper.current_indent
        indent_stack_before = formatter.wrapper.saved_indents_stack.copy()
        items = [header_only_item('h1 X'),
                 header_only_item('h2 Y')]
        list_format = lf.ListFormat(HeaderFormatWithVaryingFollowingLineIndent(3),
                                    NO_SEPARATIONS)
        formatter.format_header_value_list_according_to_format(items,
                                                               list_format)
        self.assertEqual(current_indent_before,
                         formatter.wrapper.current_indent,
                         'Current indent')

        self.assertEqual(indent_stack_before,
                         formatter.wrapper.saved_indents_stack,
                         'Saved indents stack')
예제 #9
0
파일: lists.py 프로젝트: emilkarlen/exactly
 def test_varying_header_following_line_indent(self):
     formatter = formatter_with_page_width(4)
     items = [header_only_item('h1 X'),
              header_only_item('h2 Y'),
              header_only_item('h3 Z')]
     list_format = lf.ListFormat(HeaderFormatWithVaryingFollowingLineIndent(3),
                                 NO_SEPARATIONS,
                                 indent_str='')
     actual = formatter.format_header_value_list_according_to_format(items,
                                                                     list_format)
     self.assertEqual(['**h1',
                       '  X',
                       '*h2',
                       ' Y',
                       '**h3',
                       '  Z'],
                      actual)
예제 #10
0
 def test_ordered_list(self):
     items = [header_only_item('header')]
     formatter = sut.Formatter(CROSS_REF_TITLE_ONLY_TEXT_FORMATTER,
                               sut.Wrapper(page_width=100),
                               list_formats=self.LIST_FORMATS)
     actual = formatter.format_header_content_list(
         lists.HeaderContentList(items,
                                 lists.Format(lists.ListType.ORDERED_LIST)))
     self.assertEqual(['1. header'], actual)
예제 #11
0
파일: lists.py 프로젝트: emilkarlen/exactly
 def test_variable_list(self):
     items = [header_only_item('header')]
     formatter = sut.Formatter(CROSS_REF_TITLE_ONLY_TEXT_FORMATTER,
                               sut.Wrapper(page_width=100),
                               list_formats=self.LIST_FORMATS)
     actual = formatter.format_header_content_list(
         lists.HeaderContentList(items,
                                 lists.Format(lists.ListType.VARIABLE_LIST)))
     self.assertEqual(['header'],
                      actual)
예제 #12
0
 def test_only_initial_paragraphs(self):
     paragraph_item_formatter = paragraph_item.Formatter(
         CROSS_REF_TITLE_ONLY_TEXT_FORMATTER,
         paragraph_item.Wrapper(page_width=5),
         num_item_separator_lines=1,
         list_formats=lf.ListFormats(variable_list_format=lf.ListFormat(
             lf.HeaderAndIndentFormatPlain(),
             lists.Separations(0, 0),
             indent_str='')))
     formatter = sut.Formatter(paragraph_item_formatter)
     section_contents = SectionContents([
         single_text_para('12345 123 5'),
         lists.HeaderContentList(
             [header_only_item('12345 123')],
             lists.Format(lists.ListType.VARIABLE_LIST),
         )
     ], [])
     actual = formatter.format_section_contents(section_contents)
     self.assertEqual(['12345', '123 5', BLANK_LINE, '12345', '123'],
                      actual)
예제 #13
0
 def test_only_initial_paragraphs(self):
     paragraph_item_formatter = paragraph_item.Formatter(CROSS_REF_TITLE_ONLY_TEXT_FORMATTER,
                                                         paragraph_item.Wrapper(page_width=5),
                                                         num_item_separator_lines=1,
                                                         list_formats=lf.ListFormats(
                                                             variable_list_format=lf.ListFormat(
                                                                 lf.HeaderAndIndentFormatPlain(),
                                                                 lists.Separations(0, 0),
                                                                 indent_str='')))
     formatter = sut.Formatter(paragraph_item_formatter)
     section_contents = SectionContents([single_text_para('12345 123 5'),
                                         lists.HeaderContentList([header_only_item('12345 123')],
                                                                 lists.Format(lists.ListType.VARIABLE_LIST),
                                                                 )],
                                        [])
     actual = formatter.format_section_contents(section_contents)
     self.assertEqual(['12345',
                       '123 5',
                       BLANK_LINE,
                       '12345',
                       '123'],
                      actual)
예제 #14
0
 def test_multi_element_list(self):
     formatter = formatter_with_page_width(5)
     items = [header_only_item('45 4'), header_only_item('ab c')]
     actual = formatter.format_header_value_list_according_to_format(
         items, list_formatter_with_no_blank_lines)
     self.assertEqual(['1. 45', '   4', '2. ab', '   c'], actual)
예제 #15
0
 def test_singleton_list(self):
     formatter = formatter_with_page_width(5)
     items = [header_only_item('45 4')]
     actual = formatter.format_header_value_list_according_to_format(
         items, list_formatter_with_no_blank_lines)
     self.assertEqual(['1. 45', '   4'], actual)
예제 #16
0
 def test_multi_element_list(self):
     items = [header_only_item('header 1'), header_only_item('header 2')]
     formatter = formatter_with_page_width(20)
     actual = formatter.format_header_value_list_according_to_format(
         items, list_formatter_with_no_blank_lines)
     self.assertEqual(['1. header 1', '2. header 2'], actual)
예제 #17
0
 def test_singleton_list(self):
     items = [header_only_item('header')]
     formatter = formatter_with_page_width(10)
     actual = formatter.format_header_value_list_according_to_format(
         items, self.list_format)
     self.assertEqual(['1. header'], actual)