MCPcopy Create free account
hub / github.com/webpy/webpy / testAttr

Method testAttr

tests/test_template.py:37–46  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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')"

Callers

nothing calls this directly

Calls 1

tFunction · 0.85

Tested by

no test coverage detected