When trying to remove from KeyBindings by Keys, an undocumented UnboundLocalError exception is raised instead of the documented ValueError.
To repro can add something like the following to test_remove_bindings:
h3 = handlers.controla
...
# Test passing unbound key sequence to the remove() function
with pytest.raises(ValueError):
bindings.remove(h3)
with pytest.raises(ValueError):
bindings.remove(Keys.ControlA)