Show More
@@ -258,6 +258,18 b' class InteractiveShellTestCase(unittest.TestCase):' | |||||
258 | ip.run_cell('makemacro()') |
|
258 | ip.run_cell('makemacro()') | |
259 | nt.assert_in('macro_var_expand_locals', ip.user_ns) |
|
259 | nt.assert_in('macro_var_expand_locals', ip.user_ns) | |
260 |
|
260 | |||
|
261 | def test_var_expand_self(self): | |||
|
262 | """Test variable expansion with the name 'self', which was failing. | |||
|
263 | ||||
|
264 | See https://github.com/ipython/ipython/issues/1878#issuecomment-7698218 | |||
|
265 | """ | |||
|
266 | ip.run_cell('class cTest:\n' | |||
|
267 | ' classvar="see me"\n' | |||
|
268 | ' def test(self):\n' | |||
|
269 | ' res = !echo Variable: {self.classvar}\n' | |||
|
270 | ' return res\n') | |||
|
271 | nt.assert_in('see me', ip.user_ns['cTest']().test()) | |||
|
272 | ||||
261 | def test_bad_var_expand(self): |
|
273 | def test_bad_var_expand(self): | |
262 | """var_expand on invalid formats shouldn't raise""" |
|
274 | """var_expand on invalid formats shouldn't raise""" | |
263 | # SyntaxError |
|
275 | # SyntaxError |
General Comments 0
You need to be logged in to leave comments.
Login now