(self)
| 35 | self.assertRaises(NameError, t(tpl)) |
| 36 | |
| 37 | def testAttr(self): |
| 38 | tpl = "$code:\n (lambda x: x+1).func_code" |
| 39 | self.assertRaises(SecurityError, t, tpl) |
| 40 | |
| 41 | tpl = "$def with (a)\n$code:\n a.b = 3" |
| 42 | self.assertRaises(SecurityError, t, tpl) |
| 43 | |
| 44 | # these two should execute themselves flawlessly |
| 45 | t("$code:\n foo = {'a': 1}.items()")() |
| 46 | t("$code:\n bar = {k:0 for k in [1,2,3]}")() |
| 47 | |
| 48 | def test_overridden(self): |
| 49 | tpl = "$print('blah')" |