(self)
| 244 | ip.reset() |
| 245 | |
| 246 | def test_var_expand(self): |
| 247 | ip.user_ns["f"] = "Ca\xf1o" |
| 248 | self.assertEqual(ip.var_expand("echo $f"), "echo Ca\xf1o") |
| 249 | self.assertEqual(ip.var_expand("echo {f}"), "echo Ca\xf1o") |
| 250 | self.assertEqual(ip.var_expand("echo {f[:-1]}"), "echo Ca\xf1") |
| 251 | self.assertEqual(ip.var_expand("echo {1*2}"), "echo 2") |
| 252 | |
| 253 | self.assertEqual( |
| 254 | ip.var_expand("grep x | awk '{print $1}'"), "grep x | awk '{print $1}'" |
| 255 | ) |
| 256 | |
| 257 | ip.user_ns["f"] = b"Ca\xc3\xb1o" |
| 258 | # This should not raise any exception: |
| 259 | ip.var_expand("echo $f") |
| 260 | |
| 261 | def test_var_expand_local(self): |
| 262 | """Test local variable expansion in !system and %magic calls""" |
nothing calls this directly
no test coverage detected