MCPcopy Index your code
hub / github.com/python/cpython / test_eval_frozendict

Method test_eval_frozendict

Lib/test/test_builtin.py:787–795  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

785 self.assertRaises(ValueError, eval, "foo", {}, X())
786
787 def test_eval_frozendict(self):
788 ns = frozendict(x=1, data=[], __builtins__=__builtins__)
789 eval("data.append(x)", ns, ns)
790 self.assertEqual(ns['data'], [1])
791
792 ns = frozendict()
793 errmsg = "cannot assign __builtins__ to frozendict globals"
794 with self.assertRaisesRegex(TypeError, errmsg):
795 eval("", ns, ns)
796
797 def test_eval_kwargs(self):
798 data = {"A_GLOBAL_VALUE": 456}

Callers

nothing calls this directly

Calls 3

frozendictClass · 0.85
assertRaisesRegexMethod · 0.80
assertEqualMethod · 0.45

Tested by

no test coverage detected