multiple changes

This commit is contained in:
www
2021-01-11 18:45:03 +00:00
parent 14ca632137
commit 3d3474a2e1
24 changed files with 3517 additions and 83 deletions

46
tests/test_wiki.py Normal file
View File

@@ -0,0 +1,46 @@
"test des kleinen Wiki Systems"
import pytest
import wiki
@pytest.fixture
def pages():
w=wiki.PageManager(file="")
w.from_dict({
"home": {},
"home/hello":{},
"home/hello2":{"path":"homehello"}
})
return w
class TestPageAttribute:
def test_id(self,pages):
assert pages["home"].id=="home"
def test_page_hello(pages):
assert isinstance(pages["home"],wiki.Page)
class TestPageParsing:
def test_leave_html(self):
t="<b>Hello</b><ul><li>sf</li></ul>"
tout, entities=wiki.parse_intern_page(t)
assert t==tout
def test_replacebrakcets_html(self):
t="<b>Hello</b><ul><li>[uj]</li></ul>"
tout, entities=wiki.parse_intern_page(t)
assert not t==tout
assert tout=='<b>Hello</b><ul><li><a href="/wiki/uj">uj</a></li></ul>'
def test_replace_tags_html(self):
t="<b>Hello</b><ul><li>#uj</li></ul>"
tout, entities=wiki.parse_intern_page(t)
assert not t==tout
assert tout=='<b>Hello</b><ul><li><a href="/tag/uj">#uj</a></li></ul>'
def test_replace_tags_inentities(self):
t="<b>Hello</b><ul><li>#uj</li></ul>"
tout, entities=wiki.parse_intern_page(t)
assert "uj" in entities["tags"]