File: test_readers.py

package info (click to toggle)
python-pweave 0.30.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 5,064 kB
  • sloc: python: 30,281; makefile: 167
file content (30 lines) | stat: -rw-r--r-- 993 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import pweave

def test_markdown():
    """Test markdown reader"""
    pweave.weave("tests/readers/markdown_reader.pmd", doctype = "pandoc", informat = "markdown")
    assertSameContent("tests/readers/markdown_reader.md", "tests/readers/markdown_reader_ref.md")

def test_script():
    """Test markdown reader"""
    doc = pweave.Pweb("tests/publish/publish_test.txt", doctype = "pandoc", informat="script")
    doc.tangle()
    assertSameContent("tests/publish/publish_test.py",
                      "tests/publish/publish_test_REF.py")


def test_url():
    pweave.weave("http://files.mpastell.com/formatters_test.pmd", doctype = "pandoc", output = "tests/formats/formatters_url.md")
    assertSameContent("tests/formats/formatters_url.md", "tests/formats/formatters_test_REF.markdown")



def assertSameContent(REF, outfile):
    out = open(outfile)
    ref = open(REF)
    assert (out.read() == ref.read())

if __name__ == '__main__':
    test_markdown()
    test_script()
    test_url()