aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2015-02-07 18:55:24 +0000
committerMichael Williamson <mike@zwobble.org>2015-02-07 18:55:24 +0000
commit57eddaefd1961884cddbaf427459822ad8811aeb (patch)
tree1693604dfbd460f861227915b9734a4b9ebeb3eb /tests
parente0b022e52d720758023bb0248ea0a17a4cbbb822 (diff)
Add scaffolding for markdown
Diffstat (limited to 'tests')
-rw-r--r--tests/cli_tests.py8
-rw-r--r--tests/mammoth_tests.py8
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/cli_tests.py b/tests/cli_tests.py
index f76df45..4728c6b 100644
--- a/tests/cli_tests.py
+++ b/tests/cli_tests.py
@@ -66,3 +66,11 @@ def style_map_is_used_if_set():
result = _local.run(["mammoth", docx_path, "--style-map", style_map_path])
assert_equal(b"", result.stderr_output)
assert_equal(b"<span>Walking on imported air</span>", result.output)
+
+
+@istest
+def output_format_markdown_option_generates_markdown_output():
+ docx_path = test_path("single-paragraph.docx")
+ result = _local.run(["mammoth", docx_path, "--output-format=markdown"])
+ assert_equal(b"", result.stderr_output)
+ assert_equal(b"Walking on imported air\n\n", result.output)
diff --git a/tests/mammoth_tests.py b/tests/mammoth_tests.py
index c5f2557..ce76221 100644
--- a/tests/mammoth_tests.py
+++ b/tests/mammoth_tests.py
@@ -99,6 +99,14 @@ def transform_document_is_applied_to_document_before_conversion():
@istest
+def docx_containing_one_paragraph_can_be_converted_to_markdown():
+ with open(test_path("single-paragraph.docx"), "rb") as fileobj:
+ result = mammoth.convert_to_markdown(fileobj=fileobj)
+ assert_equal("Walking on imported air\n\n", result.value)
+ assert_equal([], result.messages)
+
+
+@istest
def can_extract_raw_text():
with open(test_path("simple-list.docx"), "rb") as fileobj:
result = mammoth.extract_raw_text(fileobj=fileobj)