Example #1
0
    def test_non_top_level_lists_are_indented(self):
        style = ReSTStyle(ReSTDocument())

        # Start the top level list
        style.start_ul()

        # Write one list element
        style.start_li()
        style.doc.handle_data('foo')
        style.end_li()

        self.assertEqual(style.doc.getvalue(), six.b("\n\n\n* foo\n"))

        # Start the nested list
        style.start_ul()

        # Write an element to the nested list
        style.start_li()
        style.doc.handle_data('bar')
        style.end_li()

        self.assertEqual(style.doc.getvalue(),
                         six.b("\n\n\n* foo\n\n\n  \n  * bar\n  "))
Example #2
0
    def test_non_top_level_lists_are_indented(self):
        style = ReSTStyle(ReSTDocument())

        # Start the top level list
        style.start_ul()

        # Write one list element
        style.start_li()
        style.doc.handle_data('foo')
        style.end_li()

        self.assertEqual(style.doc.getvalue(), six.b("\n\n\n* foo\n"))

        # Start the nested list
        style.start_ul()

        # Write an element to the nested list
        style.start_li()
        style.doc.handle_data('bar')
        style.end_li()

        self.assertEqual(style.doc.getvalue(),
                         six.b("\n\n\n* foo\n\n\n  \n  * bar\n  "))