1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-09-19 03:32:31 +01:00

Fix the @wrap_settings annotation

It seems much more useful if it only adds settings that are not already
set.
This commit is contained in:
mcarton
2015-08-17 15:46:29 +02:00
parent 4a2f869c6d
commit 88831c424f
3 changed files with 10 additions and 6 deletions

View File

@@ -9,7 +9,8 @@ from tests.utils import Command
@pytest.mark.parametrize('override, old, new', [
({'key': 'val'}, {}, {'key': 'val'}),
({'key': 'new-val'}, {'key': 'val'}, {'key': 'new-val'})])
({'key': 'new-val'}, {'key': 'val'}, {'key': 'val'}),
({'key': 'new-val', 'unset': 'unset'}, {'key': 'val'}, {'key': 'val', 'unset': 'unset'})])
def test_wrap_settings(override, old, new):
fn = lambda _, settings: settings
assert wrap_settings(override)(fn)(None, Settings(old)) == new