(f)
| 115 | nt.assert_raises(NameError, f.format, '{dne}', **ns) |
| 116 | |
| 117 | def 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 | |
| 128 | def eval_formatter_no_slicing_check(f): |
| 129 | ns = dict(n=12, pi=math.pi, stuff='hello there', os=os) |
no test coverage detected