MCPcopy Create free account
hub / github.com/ipython/ipython / eval_formatter_slicing_check

Function eval_formatter_slicing_check

IPython/utils/tests/test_text.py:117–126  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

115 nt.assert_raises(NameError, f.format, '{dne}', **ns)
116
117def eval_formatter_slicing_check(f):
118 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
119 s = f.format(" {stuff.split()[:]} ", **ns)
120 nt.assert_equal(s, " ['hello', 'there'] ")
121 s = f.format(" {stuff.split()[::-1]} ", **ns)
122 nt.assert_equal(s, " ['there', 'hello'] ")
123 s = f.format("{stuff[::2]}", **ns)
124 nt.assert_equal(s, ns['stuff'][::2])
125
126 nt.assert_raises(SyntaxError, f.format, "{n:x}", **ns)
127
128def eval_formatter_no_slicing_check(f):
129 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)

Callers 2

test_full_eval_formatterFunction · 0.85
test_dollar_formatterFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected