##// END OF EJS Templates
Fix EvalFormatter test for Python 3.4...
Thomas Kluyver -
Show More
@@ -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()
General Comments 0
You need to be logged in to leave comments. Login now