-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[f] to.be.callable #32
Conversation
@NhanHo @hieueastagile Please take a look. |
robber/matchers/callable.py
Outdated
""" | ||
|
||
def matches(self): | ||
return hasattr(self.actual, '__call__') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm doing some quick googling and it looks like this is not all the cases. They are still checking for another condition to make sure it's callable. And I found out that we might be able to use callable
builtin function, just need to re-check careful how this function is support among python versions. Wdyt?
My ref:
http://stackoverflow.com/questions/111234/what-is-a-callable-in-python
https://docs.python.org/2/library/functions.html#callable
tests/matchers/test_callable.py
Outdated
expect(Callable(a).matches()) == True | ||
|
||
def test_failure_message(self): | ||
callable = Callable("a") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And according to my above explaination, callable
is a builtin function, so it's better that we choose another name for our variable.
@hieueastagile : which python do we plan to support? Is anyone using python 3.0 or 3.1? In python 3.x However, python 3.2 added It seems like using |
@NhanHo Thanks for the very details information. I think we only support for python 2.6, 2.7, 3.4, 3.5, 3.6 (see the tox.ini for more information if you like to). So regarding your reference, I think that we should use |
Issue: #20
We will add this expectation to our code base: