Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_file_loader(tmpdir, mocker):
"""Test the built-in file loader extension
"""
mocker.patch.object(lookatme.config, "LOG")
fake_config = mocker.patch.object(lookatme.render.markdown_block, "config")
mocker.patch.object(lookatme.render.pygments, "config", fake_config)
fake_config.STYLE = TEST_STYLE
tmppath = tmpdir.join("test.py")
tmppath.write("print('hello')")
rendered = render_markdown(f"""
```file
path: {tmppath}
relative: false
""")
stripped_rows = [
b'',
b"print('hello')",
b'',
def test_inline(mocker):
"""Test inline markdown
"""
mocker.patch.object(lookatme.config, "LOG")
fake_config = mocker.patch.object(lookatme.render.pygments, "config")
mocker.patch.object(lookatme.render.markdown_inline, "config", fake_config)
fake_config.STYLE = {
"style": "monokai",
"link": {
"fg": "underline",
"bg": "default",
},
}
rendered = render_markdown("*emphasis*")
assert len(rendered) == 3
assert rendered[1][0][0].foreground == "default,italics"
assert row_text(rendered[1]).strip() == b"emphasis"
rendered = render_markdown("**emphasis**")
assert len(rendered) == 3