(self)
| 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() |
nothing calls this directly
no test coverage detected