From 4da382511b4de5dcea9e0397bac6e64ce8764906 2014-01-06 18:28:02 From: Thomas Kluyver Date: 2014-01-06 18:28:02 Subject: [PATCH] Fix EvalFormatter test for Python 3.4 Changes to string formatting mean slicing in EvalFormatter now works. --- diff --git a/IPython/utils/tests/test_text.py b/IPython/utils/tests/test_text.py index 5a9eb21..96e714a 100644 --- a/IPython/utils/tests/test_text.py +++ b/IPython/utils/tests/test_text.py @@ -16,6 +16,7 @@ from __future__ import print_function import os import math import random +import sys import nose.tools as nt @@ -108,7 +109,12 @@ def eval_formatter_no_slicing_check(f): s = f.format('{stuff[slice(1,4)]}', **ns) nt.assert_equal(s, 'ell') - nt.assert_raises(SyntaxError, f.format, "{a[:]}") + if sys.version_info >= (3, 4): + # String formatting has changed in Python 3.4, so this now works. + s = f.format("{a[:]}", a=[1, 2]) + nt.assert_equal(s, "[1, 2]") + else: + nt.assert_raises(SyntaxError, f.format, "{a[:]}") def test_eval_formatter(): f = text.EvalFormatter()