MCPcopy Create free account
hub / github.com/cdgriffith/Box / test_no_init_override_needed

Method test_no_init_override_needed

test/test_box_defaults.py:61–68  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

59 _box_defaults = {"defualt_box": True}
60
61 def test_no_init_override_needed(self):
62 # The pattern people tried in #296 / #223 fails, this is the replacement
63 class MyConfig(Box):
64 _box_defaults = {"default_box": True, "box_dots": True}
65
66 config = MyConfig()
67 config["server.host"] = "localhost"
68 assert config.to_dict() == {"server": {"host": "localhost"}}
69
70 def test_copy_pickle_and_conversions_keep_defaults(self):
71 b = DefaultBox({"a": {"b": 1}})

Callers

nothing calls this directly

Calls 2

MyConfigClass · 0.85
to_dictMethod · 0.80

Tested by

no test coverage detected