Show More
@@ -11,6 +11,7 b'' | |||||
11 | #----------------------------------------------------------------------------- |
|
11 | #----------------------------------------------------------------------------- | |
12 |
|
12 | |||
13 | from ..citation import citation2latex |
|
13 | from ..citation import citation2latex | |
|
14 | from nose.tools import assert_equal | |||
14 |
|
15 | |||
15 | #----------------------------------------------------------------------------- |
|
16 | #----------------------------------------------------------------------------- | |
16 | # Tests |
|
17 | # Tests | |
@@ -51,8 +52,8 b' Lorem ipsum dolor sit amet, consectetur adipiscing elit' | |||||
51 | def test_citation2latex(): |
|
52 | def test_citation2latex(): | |
52 | """Are citations parsed properly?""" |
|
53 | """Are citations parsed properly?""" | |
53 | try: |
|
54 | try: | |
54 | import lxml |
|
55 | from lxml import html #analysis:ignore | |
55 | except ImportError: |
|
56 | except ImportError: | |
56 |
assert |
|
57 | assert_equal(test_md, citation2latex(test_md)) | |
57 | else: |
|
58 | else: | |
58 |
assert |
|
59 | assert_equal(test_md_parsed, citation2latex(test_md)) |
@@ -16,6 +16,7 b' from __future__ import print_function' | |||||
16 | import os |
|
16 | import os | |
17 | import math |
|
17 | import math | |
18 | import random |
|
18 | import random | |
|
19 | import sys | |||
19 |
|
20 | |||
20 | import nose.tools as nt |
|
21 | import nose.tools as nt | |
21 |
|
22 | |||
@@ -108,7 +109,12 b' def eval_formatter_no_slicing_check(f):' | |||||
108 | s = f.format('{stuff[slice(1,4)]}', **ns) |
|
109 | s = f.format('{stuff[slice(1,4)]}', **ns) | |
109 | nt.assert_equal(s, 'ell') |
|
110 | nt.assert_equal(s, 'ell') | |
110 |
|
111 | |||
111 | nt.assert_raises(SyntaxError, f.format, "{a[:]}") |
|
112 | if sys.version_info >= (3, 4): | |
|
113 | # String formatting has changed in Python 3.4, so this now works. | |||
|
114 | s = f.format("{a[:]}", a=[1, 2]) | |||
|
115 | nt.assert_equal(s, "[1, 2]") | |||
|
116 | else: | |||
|
117 | nt.assert_raises(SyntaxError, f.format, "{a[:]}") | |||
112 |
|
118 | |||
113 | def test_eval_formatter(): |
|
119 | def test_eval_formatter(): | |
114 | f = text.EvalFormatter() |
|
120 | f = text.EvalFormatter() |
@@ -517,6 +517,9 b' class EvalFormatter(Formatter):' | |||||
517 | v = eval(name, kwargs) |
|
517 | v = eval(name, kwargs) | |
518 | return v, name |
|
518 | return v, name | |
519 |
|
519 | |||
|
520 | #XXX: As of Python 3.4, the format string parsing no longer splits on a colon | |||
|
521 | # inside [], so EvalFormatter can handle slicing. Once we only support 3.4 and | |||
|
522 | # above, it should be possible to remove FullEvalFormatter. | |||
520 |
|
523 | |||
521 | @skip_doctest_py3 |
|
524 | @skip_doctest_py3 | |
522 | class FullEvalFormatter(Formatter): |
|
525 | class FullEvalFormatter(Formatter): |
General Comments 0
You need to be logged in to leave comments.
Login now