Exemple #1
0
    def test_normal_MediaWikiTableFileLoader_null_tag(self, monkeypatch, value,
                                                      source, expected):
        monkeypatch.setattr(MediaWikiTableFormatter, "table_id",
                            self.null_tag_property)

        loader = ptr.MediaWikiTableFileLoader(source)
        loader.table_name = value
        formatter = MediaWikiTableFormatter(value)
        formatter.accept(loader)

        assert formatter._make_table_name() == expected
Exemple #2
0
    def test_exception_MediaWikiTableTextLoader(self, monkeypatch, value,
                                                source, expected):
        monkeypatch.setattr(MediaWikiTableFormatter, "table_id",
                            self.valid_tag_property)

        loader = ptr.MediaWikiTableTextLoader(source)
        loader.table_name = value
        formatter = MediaWikiTableFormatter(source)
        formatter.accept(loader)

        with pytest.raises(expected):
            print(formatter._make_table_name())
Exemple #3
0
    def test_normal_MediaWikiTableTextLoader_valid_tag(self, monkeypatch,
                                                       value, expected):
        monkeypatch.setattr(MediaWikiTableFormatter, "table_id",
                            self.valid_tag_property)

        source = "<table></table>"
        loader = ptr.MediaWikiTableTextLoader(source)
        loader.table_name = value
        formatter = MediaWikiTableFormatter(source)
        formatter.accept(loader)

        assert formatter._make_table_name() == expected