aboutsummaryrefslogtreecommitdiff
path: root/plugins/render_math/test_render_math.py
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/render_math/test_render_math.py')
-rw-r--r--[-rwxr-xr-x]plugins/render_math/test_render_math.py28
1 files changed, 17 insertions, 11 deletions
diff --git a/plugins/render_math/test_render_math.py b/plugins/render_math/test_render_math.py
index b71f4e7..dc1e5fd 100755..100644
--- a/plugins/render_math/test_render_math.py
+++ b/plugins/render_math/test_render_math.py
@@ -10,22 +10,22 @@ from pelican.writers import Writer
from .math import pelican_init, process_rst_and_summaries
-
CUR_DIR = dirname(__file__)
class RenderMathTest(unittest.TestCase):
def test_ok_on_shared_test_data(self):
settings = get_settings(filenames={})
- settings['PATH'] = join(CUR_DIR, '..', 'test_data')
+ settings["PATH"] = join(CUR_DIR, "..", "test_data")
pelican_init(PelicanMock(settings))
with TemporaryDirectory() as tmpdirname:
generator = _build_article_generator(settings, tmpdirname)
process_rst_and_summaries([generator])
+
def test_ok_on_custom_data(self):
settings = get_settings(filenames={})
- settings['PATH'] = join(CUR_DIR, 'test_data')
- settings['PLUGINS'] = ['pelican-ipynb.markup'] # to also parse .ipynb files
+ settings["PATH"] = join(CUR_DIR, "test_data")
+ settings["PLUGINS"] = ["pelican-ipynb.markup"] # to also parse .ipynb files
configure_settings(settings)
pelican_mock = PelicanMock(settings)
pelican_init(pelican_mock)
@@ -34,23 +34,29 @@ class RenderMathTest(unittest.TestCase):
generator = _build_article_generator(settings, tmpdirname)
process_rst_and_summaries([generator])
for article in generator.articles:
- if article.source_path.endswith('.rst'):
- self.assertIn('mathjaxscript_pelican', article.content)
+ if article.source_path.endswith(".rst"):
+ self.assertIn("mathjaxscript_pelican", article.content)
generator.generate_output(Writer(tmpdirname, settings=settings))
def _build_article_generator(settings, output_path):
context = settings.copy()
- context['generated_content'] = dict()
- context['static_links'] = set()
+ context["generated_content"] = dict()
+ context["static_links"] = set()
article_generator = ArticlesGenerator(
- context=context, settings=settings,
- path=settings['PATH'], theme=settings['THEME'], output_path=output_path)
+ context=context,
+ settings=settings,
+ path=settings["PATH"],
+ theme=settings["THEME"],
+ output_path=output_path,
+ )
article_generator.generate_context()
return article_generator
+
class PelicanMock:
- 'A dummy class exposing the only attributes needed'
+ "A dummy class exposing the only attributes needed"
+
def __init__(self, settings):
self.plugins = []
self.settings = settings