Skip to content

Commit

Permalink
refactor: simplify doctest cases and add one more to .inputs.is_input…
Browse files Browse the repository at this point in the history
…_obj
  • Loading branch information
ssato committed May 21, 2018
1 parent 305f8f8 commit 3675999
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions anyconfig/inputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@ def is_input_obj(obj):
"""
:return: True if given something `obj` is a 'Input' namedtuple object.
>>> assert is_input_obj(1) == False
>>> assert is_input_obj("aaa") == False
>>> assert is_input_obj({}) == False
>>> assert not is_input_obj(1)
>>> assert not is_input_obj("aaa")
>>> assert not is_input_obj({})
>>> assert not is_input_obj(('a', 1, {}))
>>> inp = Input("/etc/hosts", PATH_STR, "/etc/hosts", None, open)
>>> assert is_input_obj(inp)
"""
if isinstance(obj, tuple) and getattr(obj, "_asdict", False):
# I don't think there is another way to do that.
return all(k in obj._asdict() for k in _INPUT_KEYS)

return False
Expand Down

0 comments on commit 3675999

Please sign in to comment.