Skip to content

Commit

Permalink
Do not complain about missing overriden arguments
Browse files Browse the repository at this point in the history
resolves #8
  • Loading branch information
GuillaumeLeclerc committed Apr 8, 2021
1 parent cb6129c commit 90f0e8f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fastargs/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ def __call__(self, *args, **kwargs):
for ns, path, alias in self.arg_paths:
if ns is not None:
path = ns + path
if alias in kwargs: # User overrode this argument
continue
value = config[path]
if value is not None:
filled_args[alias] = value
Expand Down
7 changes: 7 additions & 0 deletions tests/test_decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,13 @@ def compute(p1, p2):

self.assertEqual(compute(), 111)

def test_do_not_complain_not_missing_args(self):
@param('sec1.p1')
def compute(p1):
return p1

self.assertEqual(compute(p1=17), 17)


if __name__ == '__main__':
unittest.main()

0 comments on commit 90f0e8f

Please sign in to comment.