MCPcopy Index your code
hub / github.com/ipython/ipython / eval_formatter_slicing_check

Function eval_formatter_slicing_check

tests/test_text.py:59–68  ·  view source on GitHub ↗
(f)

Source from the content-addressed store, hash-verified

57
58
59def eval_formatter_slicing_check(f):
60 ns = dict(n=12, pi=math.pi, stuff="hello there", os=os)
61 s = f.format(" {stuff.split()[:]} ", **ns)
62 assert s == " ['hello', 'there'] "
63 s = f.format(" {stuff.split()[::-1]} ", **ns)
64 assert s == " ['there', 'hello'] "
65 s = f.format("{stuff[::2]}", **ns)
66 assert s == ns["stuff"][::2]
67
68 pytest.raises(SyntaxError, f.format, "{n:x}", **ns)
69
70
71def eval_formatter_no_slicing_check(f):

Callers 2

test_full_eval_formatterFunction · 0.85
test_dollar_formatterFunction · 0.85

Calls 1

formatMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…