Skip to content

Conversation

@jmoldow
Copy link
Contributor

@jmoldow jmoldow commented Jul 27, 2017

This magic method was previously returning a plain, unbound
function. This tricks some introspection code, which expects it
to be a bound method.

Also add unit test coverage for that module.

Bump version to 2.0.0a6.

This magic method was previously returning a plain, unbound
function. This tricks some introspection code, which expects it
to be a bound method.

Also add unit test coverage for that module.

Bump version to 2.0.0a6.
@boxcla
Copy link

boxcla commented Jul 27, 2017

Verified that @jmoldow has signed the CLA. Thanks for the pull request!


def test_api_call_decorated_method_must_be_a_cloneable_method():

class Cls(object):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could call this NonCloneable instead of Cls

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

def test_api_call_decorated_method_delegates_to_wrapped_method(mock_cloneable, api_call_result):
args = (1, 2, 'ƒøø', 'bar')
kwargs = {'bar': 'ƒøø'}
assert mock_cloneable.api_call_method(*args, **kwargs) == (mock_cloneable, args, kwargs, api_call_result)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you could take the api_call_method fixture, and call it instead of encoding here the functionality of the method

assert mock_cloneable.api_call_method(*args, **kwargs) == api_call_method(mock_cloneable, *args, **kwargs)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to leave this as-is.

If I do what you suggest, then we'll be passing through @api_call on both the LHS and RHS of the equality.

I could expose a fixture for the unbound method, but I'd rather not do that. I think it's fine as-is.

args = (1, 2, 'ƒøø', 'bar')
kwargs = {'bar': 'ƒøø'}
api_call_method = cloneable_subclass_with_api_call_method.api_call_method
assert api_call_method(mock_cloneable, *args, **kwargs) == (mock_cloneable, args, kwargs, api_call_result)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto here

@jmoldow jmoldow merged commit d83a8b3 into master Aug 3, 2017
@jmoldow jmoldow deleted the api_dec branch August 3, 2017 21:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants