Ejemplo n.º 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
Ejemplo n.º 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())
Ejemplo n.º 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
Ejemplo n.º 4
0
 def test_exception(self, monkeypatch, value, source, expected):
     with pytest.raises(expected):
         MediaWikiTableFormatter(source)