diff options
author | Daniel Schadt <kingdread@gmx.de> | 2021-08-26 21:02:09 +0200 |
---|---|---|
committer | Daniel Schadt <kingdread@gmx.de> | 2021-08-26 21:02:09 +0200 |
commit | 0a3b5dca1fd022f0071f0fd9895e3680a23bee7a (patch) | |
tree | a474a8481b0e75f2151533b6dcd6d827c44eb16a /tests/test_document.py | |
parent | 391ffada5b7f60e9519e66eef780a1e6117d5cb6 (diff) | |
download | wikimini-0a3b5dca1fd022f0071f0fd9895e3680a23bee7a.tar.gz wikimini-0a3b5dca1fd022f0071f0fd9895e3680a23bee7a.tar.bz2 wikimini-0a3b5dca1fd022f0071f0fd9895e3680a23bee7a.zip |
start working on more tests
Diffstat (limited to 'tests/test_document.py')
-rw-r--r-- | tests/test_document.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/test_document.py b/tests/test_document.py new file mode 100644 index 0000000..35f706f --- /dev/null +++ b/tests/test_document.py @@ -0,0 +1,50 @@ +from wikimini import document + + +class TestBlockLink: + + def test_append(self): + link = document.BlockLink("https://localhost", "foo ") + link.append(document.Plain("bar")) + assert link.title == "foo bar" + + link.append(document.Style(document.Plain("qux"), False, True, False)) + assert link.title == "foo barqux" + + def test_plain(self): + link = document.BlockLink("https://localhost", "foo ") + assert link.plain() == "foo " + + def test_to_nodes(self): + link = document.BlockLink("https://localhost", "foo ") + assert link.to_nodes() == [ + document.Plain("foo ") + ] + + +class TestBlockQuote: + + def test_append(self): + quote = document.BlockQuote(document.Paragraph([])) + quote.append(document.Plain("Foo")) + assert quote.plain() == "Foo" + assert len(quote.content.nodes) == 1 + + quote.append(document.Style(document.Plain("bar"), True, True, False)) + assert quote.plain() == "Foobar" + assert len(quote.content.nodes) == 2 + + def test_plain(self): + quote = document.BlockQuote(document.Paragraph([ + document.Plain("Foo"), + document.InlineLink("http://localhost", document.Plain("bar")), + ])) + assert quote.plain() == "Foobar" + + def test_to_nodes(self): + nodes = [ + document.Plain("Foo"), + document.InlineLink("http://localhost", document.Plain("bar")), + ] + assert (document.BlockQuote(document.Paragraph(nodes)).to_nodes() + == nodes) |