Skip to content

Commit

Permalink
Added test logic for issue #316 (that's not working as expected yet)
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaTegner committed Jan 24, 2023
1 parent 2436fea commit 844f98f
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test_data/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">

<head>
<title>Test Title</title>
<meta name="viewport" content="width=device-width, initial-scale=1">

<body>

<h1 class="section">Test Heading</h1>

<div class="row">
<img src="test.png" alt="test alt" />
</div>

</body>

</html>
Binary file added test_data/test.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,21 @@ def test_basic_conversion_from_http_url(self):
received = pypandoc.convert_file(url, 'html')
assert "GPL2 license" in received

def test_conversion_with_data_files(self):
# remove our test.docx file from our test_data dir if it already exosts
test_data_dir = os.path.join(os.path.dirname(__file__), 'test_data')
test_docx_file = os.path.join(test_data_dir, 'test.docx')
if os.path.exists(test_docx_file):
os.remove(test_docx_file)
result = pypandoc.convert_file(
os.path.join(test_data_dir, 'index.html'),
to='docx',
format='html',
outputfile=test_docx_file,
sandbox=True,
)
print(result)

def test_convert_with_custom_writer(self):
lua_file_content = self.create_sample_lua()
with closed_tempfile('.md', text='# title\n') as file_name:
Expand Down

0 comments on commit 844f98f

Please sign in to comment.