mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-20 18:06:08 -05:00
[V3 Config] Require custom group initialization before usage (#2545)
* Require custom group initialization before usage and write that data to disk * Style * add tests * remove custom info update method from drivers * clean up remnant * Turn config objects into a singleton to deal with custom group identifiers * Fix dumbassery * Stupid stupid stupid
This commit is contained in:
@@ -490,3 +490,19 @@ async def test_cast_str_nested(config):
|
||||
config.register_global(foo={})
|
||||
await config.foo.set({123: True, 456: {789: False}})
|
||||
assert await config.foo() == {"123": True, "456": {"789": False}}
|
||||
|
||||
|
||||
def test_config_custom_noinit(config):
|
||||
with pytest.raises(ValueError):
|
||||
config.custom("TEST", 1, 2, 3)
|
||||
|
||||
|
||||
def test_config_custom_init(config):
|
||||
config.init_custom("TEST", 3)
|
||||
config.custom("TEST", 1, 2, 3)
|
||||
|
||||
|
||||
def test_config_custom_doubleinit(config):
|
||||
config.init_custom("TEST", 3)
|
||||
with pytest.raises(ValueError):
|
||||
config.init_custom("TEST", 2)
|
||||
|
||||
Reference in New Issue
Block a user