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

Function test_dollar_formatter

IPython/utils/tests/test_text.py:150–165  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

148 eval_formatter_slicing_check(f)
149
150def test_dollar_formatter():
151 f = text.DollarFormatter()
152 eval_formatter_check(f)
153 eval_formatter_slicing_check(f)
154
155 ns = dict(n=12, pi=math.pi, stuff='hello there', os=os)
156 s = f.format("$n", **ns)
157 nt.assert_equal(s, "12")
158 s = f.format("$n.real", **ns)
159 nt.assert_equal(s, "12")
160 s = f.format("$n/{stuff[:5]}", **ns)
161 nt.assert_equal(s, "12/hello")
162 s = f.format("$n $$HOME", **ns)
163 nt.assert_equal(s, "12 $HOME")
164 s = f.format("${foo}", foo="HOME")
165 nt.assert_equal(s, "$HOME")
166
167
168def test_long_substr():

Callers

nothing calls this directly

Calls 3

eval_formatter_checkFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected