Skip to content

Commit

Permalink
Ignore attributes available in dir() but which are not actually an at…
Browse files Browse the repository at this point in the history
…tribute

The attribute is not available with getattr()
  • Loading branch information
timofurrer committed Feb 10, 2017
1 parent d7de9af commit db34720
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sure/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1071,7 +1071,7 @@ def _new_dir(*obj):
if len(obj) > 1:
raise TypeError('dir expected at most 1 arguments, got {0}'.format(len(obj)))

patched = [x for x in old_dir(obj[0]) if isinstance(getattr(obj[0], x), AssertionBuilder)]
patched = [x for x in old_dir(obj[0]) if isinstance(getattr(obj[0], x, None), AssertionBuilder)]
return sorted(set(old_dir(obj[0])).difference(patched))

builtins.dir = _new_dir
Expand Down

0 comments on commit db34720

Please sign in to comment.