test_transformers.py
38 lines
| 879 B
| text/x-python
|
PythonLexer
/ tests / test_transformers.py
Matthias BUSSONNIER
|
r9880 | import io | ||
import nose.tools as nt | ||||
from nose.tools import nottest | ||||
Matthias BUSSONNIER
|
r9882 | from converters.latex_transformer import remove_math_space | ||
Matthias BUSSONNIER
|
r9880 | |||
@nottest | ||||
def test_space(input, reference): | ||||
Matthias BUSSONNIER
|
r9882 | nt.assert_equal(remove_math_space(input),reference) | ||
Matthias BUSSONNIER
|
r9880 | |||
def test_evens(): | ||||
Matthias BUSSONNIER
|
r9888 | unchanged = [ | ||
""" | ||||
you should be able to type | ||||
$ a single dollar and go to the line | ||||
it shouldn't be transformed. | ||||
""" | ||||
] | ||||
Matthias BUSSONNIER
|
r9880 | references = [ | ||
('$e$','$e$'), | ||||
('$ e $','$e$'), | ||||
('xxx$e^i$yyy','xxx$e^i$yyy'), | ||||
('xxx$ e^i $yyy','xxx$e^i$yyy'), | ||||
('xxx$e^i $yyy','xxx$e^i$yyy'), | ||||
('xxx$ e^i$yyy','xxx$e^i$yyy'), | ||||
('\$ e $ e $','\$ e $e$'), | ||||
Matthias BUSSONNIER
|
r9888 | ('',''), | ||
Matthias BUSSONNIER
|
r9880 | ] | ||
for k,v in references : | ||||
yield test_space, k,v | ||||
Matthias BUSSONNIER
|
r9888 | |||
for unch in unchanged : | ||||
yield test_space, unch, unch | ||||