Ejemplo n.º 1
0
    def test_ordered_with_mixed_unordered_list(self):
        expected_list = "1. Item 1\n" \
                        "2. Item 2\n" \
                        "3. Item 3\n" \
                        "4. Item 4\n" \
                        "    + Item 4.1\n" \
                        "    + Item 4.2\n" \
                        "        + Item 4.2.1\n" \
                        "        + Item 4.2.2\n" \
                        "    + Item 4.3\n" \
                        "        1. Item 4.3.1\n" \
                        "5. Item 5\n"

        items = ["Item 1", "Item 2", "Item 3", "Item 4",
                 ["+ Item 4.1", "+ Item 4.2",
                  ["+ Item 4.2.1", "+ Item 4.2.2"],
                  "+ Item 4.3", ["Item 4.3.1"]
                  ],
                 "Item 5"
                 ]

        mdlist = MDList(items, marked_with="1")
        actual_list = mdlist.get_md()

        self.assertEqual(expected_list, actual_list)
Ejemplo n.º 2
0
    def test_another_marker(self):
        marker = "*"
        expected_list = self.complex_list.replace("-", marker)
        mdlist = MDList(items=self.complex_items, marked_with=marker)
        actual_list = mdlist.get_md()

        self.assertEqual(expected_list, actual_list)
Ejemplo n.º 3
0
    def test_unordered_with_mixed_ordered_list(self):
        expected_list = self.basic_list + \
                        "- Item 4\n" \
                        "    1. Item 4.1\n" \
                        "    2. Item 4.2\n" \
                        "- Item 5\n"
        items = self.basic_items + ["Item 4", ["1. Item 4.1", "2. Item 4.2"], "Item 5"]
        mdlist = MDList(items)
        actual_list = mdlist.get_md()

        self.assertEqual(expected_list, actual_list)
Ejemplo n.º 4
0
    def new_list(self, items: [str], marked_with: str = "-"):
        """Add unordered or ordered list in MarkDown file.

        :param items: Array of items for generating the list.
        :type items: [str]
        :param marked_with: By default has the value of ``'-'``, can be ``'+'``, ``'*'``. If you want to generate
         an ordered list then set to ``'1'``.
        :type marked_with: str
        :return:
        """
        mdlist = MDList(items, marked_with)
        self.___update_file_data('\n' + mdlist.get_md())
Ejemplo n.º 5
0
    def test_ordered_list(self):
        marker = "1"
        expected_list = "1. Item 1\n" \
                        "2. Item 2\n" \
                        "3. Item 3\n" \
                        "4. Item 4\n" \
                        "    1. Item 4.1\n" \
                        "    2. Item 4.2\n" \
                        "        1. Item 4.2.1\n" \
                        "        2. Item 4.2.2\n" \
                        "    3. Item 4.3\n" \
                        "        1. Item 4.3.1\n" \
                        "5. Item 5\n"
        mdlist = MDList(items=self.complex_items, marked_with=marker)
        actual_list = mdlist.get_md()

        self.assertEqual(expected_list, actual_list)
Ejemplo n.º 6
0
    def test_complex_list(self):
        expected_list = self.complex_list
        mdlist = MDList(items=self.complex_items)
        actual_list = mdlist.get_md()

        self.assertEqual(expected_list, actual_list)
Ejemplo n.º 7
0
    def test_basic_list(self):
        expected_list = self.basic_list
        mdlist = MDList(items=self.basic_items)
        actual_list = mdlist.get_md()

        self.assertEqual(expected_list, actual_list)