##// END OF EJS Templates
Merge pull request #4758 from takluyver/testing-py34...
Thomas Kluyver -
r14094:ae1f2bef merge
parent child Browse files
Show More
@@ -11,6 +11,7 b''
11 11 #-----------------------------------------------------------------------------
12 12
13 13 from ..citation import citation2latex
14 from nose.tools import assert_equal
14 15
15 16 #-----------------------------------------------------------------------------
16 17 # Tests
@@ -51,8 +52,8 b' Lorem ipsum dolor sit amet, consectetur adipiscing elit'
51 52 def test_citation2latex():
52 53 """Are citations parsed properly?"""
53 54 try:
54 import lxml
55 from lxml import html #analysis:ignore
55 56 except ImportError:
56 assert test_md == citation2latex(test_md)
57 assert_equal(test_md, citation2latex(test_md))
57 58 else:
58 assert test_md_parsed == citation2latex(test_md)
59 assert_equal(test_md_parsed, citation2latex(test_md))
@@ -16,6 +16,7 b' from __future__ import print_function'
16 16 import os
17 17 import math
18 18 import random
19 import sys
19 20
20 21 import nose.tools as nt
21 22
@@ -108,7 +109,12 b' def eval_formatter_no_slicing_check(f):'
108 109 s = f.format('{stuff[slice(1,4)]}', **ns)
109 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 119 def test_eval_formatter():
114 120 f = text.EvalFormatter()
@@ -517,6 +517,9 b' class EvalFormatter(Formatter):'
517 517 v = eval(name, kwargs)
518 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 524 @skip_doctest_py3
522 525 class FullEvalFormatter(Formatter):
General Comments 0
You need to be logged in to leave comments. Login now