Fix /leave not working for anyone who's paused in the past
We now clear the re-activate value when a user is unpaused. Added bonus here is various bits of refactor and cleanup, with some tests
This commit is contained in:
parent
946de66f52
commit
f926a36069
5 changed files with 91 additions and 37 deletions
|
@ -10,3 +10,31 @@ def test_iterate_all_shifts():
|
|||
[3, 4, 1, 2],
|
||||
[4, 1, 2, 3],
|
||||
]
|
||||
|
||||
|
||||
def test_get_nested_dict_value():
|
||||
d = {
|
||||
"x": {
|
||||
"y": {
|
||||
"z": {
|
||||
"val": 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
assert 42 == util.get_nested_value(d, "x", "y", "z", "val")
|
||||
assert 16 == util.get_nested_value(d, "x", "y", "z", "vol", default=16)
|
||||
|
||||
|
||||
def test_set_nested_dict_value():
|
||||
d = {
|
||||
"x": {
|
||||
"y": {
|
||||
"z": {
|
||||
"val": 42
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
util.set_nested_value(d, "x", "y", "z", "val", value=52)
|
||||
assert 52 == util.get_nested_value(d, "x", "y", "z", "val")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue