MCPcopy Create free account
hub / github.com/ipython/traitlets / test_json_context_bad_write

Method test_json_context_bad_write

tests/config/test_loader.py:118–133  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

116 self.assertEqual(cl.config.MyAttr.value, value)
117
118 def test_json_context_bad_write(self):
119 fd, fname = mkstemp(".json", prefix="μnïcø∂e")
120 f = os.fdopen(fd, "w")
121 f.write("{}")
122 f.close()
123
124 with JSONFileConfigLoader(fname, log=log) as config:
125 config.A.b = 1
126
127 with self.assertRaises(TypeError), JSONFileConfigLoader(fname, log=log) as config:
128 config.A.cant_json = lambda x: x
129
130 loader = JSONFileConfigLoader(fname, log=log)
131 cfg = loader.load_config()
132 assert cfg.A.b == 1
133 assert "cant_json" not in cfg.A
134
135 def test_collision(self):
136 a = Config()

Callers

nothing calls this directly

Calls 2

load_configMethod · 0.95

Tested by

no test coverage detected