File: test_publish.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 (23 lines) | stat: -rw-r--r-- 889 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
import pweave
import os, io

def test_publish():
    """Test pypublish"""
    pweave.publish("tests/publish/publish_test.txt", doc_format="html")
    test = io.open("tests/publish/publish_test.html", "r").read().encode("utf-8")
    ref = io.open("tests/publish/publish_test_ref.html", "r").read().encode("utf-8")
    #Leave out the changing footer
    assert (test[:len(test) - 400] == ref[:len(test) - 400])

def test_publish_cell():
    """Test pypublish cell format"""
    pweave.publish("tests/publish/publish_test_cell.txt", doc_format="html")
    test = io.open("tests/publish/publish_test_cell.html", "r").read().encode("utf-8")
    ref = io.open("tests/publish/publish_test_ref.html", "r").read().encode("utf-8")
    #Leave out the changing footer
    assert (test[:len(test) - 400] == ref[:len(test) - 400])


if __name__ == '__main__':
    test_publish()
    test_publish_cell()