]> git.scottworley.com Git - paperdoorknob/blobdiff - paperdoorknob_test.py
Apply bare-\emph fix to \st too
[paperdoorknob] / paperdoorknob_test.py
index c1f8b60a85a3bc3788d7c0c002183e85ff76ba63..6481803805cde8da5fd1b76ab9a3aa3e099b65f7 100644 (file)
@@ -8,6 +8,7 @@
 from abc import ABC, abstractmethod
 import unittest
 import io
+import re
 import subprocess
 
 import paperdoorknob
@@ -41,20 +42,22 @@ class BaseTestProcess(ABC):
             FakeImageStore(),
             lambda x: x,
             lambda x: ApplyDOMFilters('NoEdit,NoFooter', x),
+            lambda x: x,
             ContentOnlyLayout(PandocTexifier('pandoc')),
             'margin=20mm',
             buf)
         paperdoorknob.process(spec)
-        assert buf.getvalue() == b'''\\documentclass{article}
-\\usepackage{graphicx}
-\\usepackage{wrapfig}
-\\usepackage[margin=20mm]{geometry}
+        assert re.match(br'''\\documentclass{article}
+(\\usepackage{[a-z]+}\n)+\\usepackage\[margin=20mm\]{geometry}
 \\begin{document}
 This is glowfic
-You \\emph{sure}?
+
+You \\emph{sure}\?
+
 Pretty sure.
+
 \\end{document}
-'''
+''', buf.getvalue())
 
     def testDirectTexifier(self) -> None:
         texifier = VerifyingTexifier(
@@ -66,6 +69,7 @@ Pretty sure.
             FakeImageStore(),
             lambda x: x,
             lambda x: ApplyDOMFilters('NoEdit,NoFooter', x),
+            lambda x: x,
             ContentOnlyLayout(texifier),
             None,
             buf)
@@ -79,7 +83,8 @@ Pretty sure.
                 FakeImageStore(),
                 lambda x: x,
                 lambda x: ApplyDOMFilters('NoEdit,NoFooter', x),
-                BelowIconLayout(PandocTexifier('pandoc')),
+                lambda x: x,
+                BelowIconLayout(PandocTexifier('pandoc'), 20),
                 None,
                 out)
             paperdoorknob.process(spec)
@@ -108,7 +113,7 @@ class TestProcessFromFakeFetcher(BaseTestProcess, unittest.TestCase):
 
     def fetcher(self) -> Fetcher:
         with open('testdata/this-is-glowfic.html', 'rb') as f:
-            return FakeFetcher({'fic': f.read(9999)})
+            return FakeFetcher({'fic?view=flat': f.read(9999)})
 
 
 if __name__ == '__main__':