##// END OF EJS Templates
Download as always starts downloads in new window/tab...
Download as always starts downloads in new window/tab This is a slightly worse user experience if it succeeds, because the new tab flashes up before closing again, but it will let us display an informative error page if it fails, without navigating the user away from the interactive notebook view.

File last commit:

r12299:5ac3d9ac
r13838:19c6ee99
Show More
test_citation.py
58 lines | 2.1 KiB | text/x-python | PythonLexer
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from ..citation import citation2latex
#-----------------------------------------------------------------------------
# Tests
#-----------------------------------------------------------------------------
test_md = """
# My Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac magna non augue
porttitor scelerisque ac id diam <cite data-cite="granger">Granger</cite>. Mauris elit
velit, lobortis sed interdum at, vestibulum vitae libero <strong data-cite="fperez">Perez</strong>.
Lorem ipsum dolor sit amet, consectetur adipiscing elit
<em data-cite="takluyver">Thomas</em>. Quisque iaculis ligula ut ipsum mattis viverra.
<p>Here is a plain paragraph that should be unaffected.</p>
* One <cite data-cite="jdfreder">Jonathan</cite>.
* Two <cite data-cite="carreau">Matthias</cite>.
* Three <cite data-cite="ivanov">Paul</cite>.
"""
test_md_parsed = """
# My Heading
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ac magna non augue
porttitor scelerisque ac id diam \cite{granger}. Mauris elit
velit, lobortis sed interdum at, vestibulum vitae libero \cite{fperez}.
Lorem ipsum dolor sit amet, consectetur adipiscing elit
\cite{takluyver}. Quisque iaculis ligula ut ipsum mattis viverra.
<p>Here is a plain paragraph that should be unaffected.</p>
* One \cite{jdfreder}.
* Two \cite{carreau}.
* Three \cite{ivanov}.
"""
def test_citation2latex():
"""Are citations parsed properly?"""
try:
import lxml
except ImportError:
assert test_md == citation2latex(test_md)
else:
assert test_md_parsed == citation2latex(test_md)