示例#1
0
    def test_get_row_no_chapter(self):
        one_line_dict = {
            "lemma": "lemma",
            "previous": "previous",
            "next": "next",
            "redirect": False,
            "chapters": []
        }
        re_register_lemma = Lemma(one_line_dict, self.volumes["I,1"],
                                  self.authors)
        expected_row = """|-
||
||
|style="background:#AA0000"|UNK"""
        compare(expected_row, re_register_lemma.get_table_row())
示例#2
0
    def test_get_row(self):
        one_line_dict = {
            "lemma": "lemma",
            "previous": "previous",
            "next": "next",
            "short_description": "Blub",
            "wp_link": "w:en:Lemma",
            "ws_link": "s:de:Lemma",
            "redirect": False,
            "chapters": [{
                "start": 1,
                "end": 1,
                "author": "Abel"
            }]
        }
        re_register_lemma = Lemma(one_line_dict, self.volumes["I,1"],
                                  self.authors)
        expected_row = """|-
|[https://elexikon.ch/meyers/RE/I,1_1.png 1]
|Herman Abel
|style="background:#FFCBCB"|2069"""
        compare(expected_row, re_register_lemma.get_table_row())
        two_line_dict = {
            "lemma":
            "lemma",
            "previous":
            "previous",
            "next":
            "next",
            "short_description":
            "Blub",
            "wp_link":
            "w:en:Lemm",
            "ws_link":
            "s:de:Lemma",
            "redirect":
            False,
            "chapters": [{
                "start": 1,
                "end": 1,
                "author": "Abel"
            }, {
                "start": 1,
                "end": 4,
                "author": "Abbott"
            }]
        }
        re_register_lemma = Lemma(two_line_dict, self.volumes["I,1"],
                                  self.authors)
        expected_row = """|-
|[https://elexikon.ch/meyers/RE/I,1_1.png 1]
|Herman Abel
|rowspan=2 style="background:#FFCBCB"|2100
|-
|[https://elexikon.ch/meyers/RE/I,1_1.png 1]-4
|William Abbott"""
        compare(expected_row, re_register_lemma.get_table_row())
        expected_row = """|-
|rowspan=2|I,1
|[https://elexikon.ch/meyers/RE/I,1_1.png 1]
|Herman Abel
|rowspan=2 style="background:#FFCBCB"|2100
|-
|[https://elexikon.ch/meyers/RE/I,1_1.png 1]-4
|William Abbott"""
        compare(expected_row,
                re_register_lemma.get_table_row(print_volume=True))