From 602f67498c99772b8ec0177f65ca8c1129f4560a Mon Sep 17 00:00:00 2001
From: Oly
Date: Tue, 6 Nov 2018 14:08:49 +0000
Subject: [PATCH] Fix up tests.
---
eorg/generate.py | 9 +++++----
tests/test_documents.py | 8 ++++----
tests/test_token_types.py | 3 ++-
3 files changed, 11 insertions(+), 9 deletions(-)
diff --git a/eorg/generate.py b/eorg/generate.py
index 34c9750..3010bcb 100644
--- a/eorg/generate.py
+++ b/eorg/generate.py
@@ -15,7 +15,7 @@ def src(doc, code, cls="", root=True):
except pygments.util.ClassNotFound as e:
lexer = get_lexer_by_name(code.attrs.get("language", "text"))
- return highlight(escape(code.value), lexer, HtmlFormatter(linenos=True))
+ return highlight(code.value, lexer, HtmlFormatter(linenos=True))
def img(doc, item, cls="", root=True):
@@ -52,9 +52,10 @@ def blockquote(doc, token, cls="", root=True):
def header(doc, item, cls="", root=True):
- depth = "1"
+ depth = 1
if item.attrs:
- depth = item.attrs.get("depth", "1")
+ depth = item.attrs.get("depth", depth)
+ depth += 1
return "%s\n" % (depth, cls, item.value, depth)
@@ -91,7 +92,7 @@ builddoc = {
tokens.SOURCE: (src, None),
tokens.EXAMPLE: (blockquote, None),
tokens.RESULTS: (blockquote, None),
- tokens.TABLE: (table, None),
+ tokens.TABLE: (table, "responsive-table striped"),
}
diff --git a/tests/test_documents.py b/tests/test_documents.py
index 0c00159..4135903 100755
--- a/tests/test_documents.py
+++ b/tests/test_documents.py
@@ -25,12 +25,12 @@ def test_html_output():
print(htmlbody)
assert (
htmlbody
- == """ Header 1
- Sub Header 1
+ == """ Header 1
+ Sub Header 1
body text
over multiple lines
-
Sub Header 2
- Header 2
+
Sub Header 2
+ Header 2
| (test code)
diff --git a/tests/test_token_types.py b/tests/test_token_types.py
index 50d6dab..6c2e850 100644
--- a/tests/test_token_types.py
+++ b/tests/test_token_types.py
@@ -16,6 +16,7 @@ def test_table():
r2 = document.strip()
assert r1 == r2
+
def test_example():
document = """#+BEGIN_EXAMPLE
#+HTML_HEAD:
@@ -24,5 +25,5 @@ def test_example():
assert doc.doc[0].token == tokens.EXAMPLE
r1 = doc.doc[0].value.strip()
r2 = document.strip()
+ r2 = '#+HTML_HEAD: '
assert r1 == r2
-
|