Skip to content
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

Feature suggestions (C# Moq inspiration) #1

Open
Eldar1205 opened this issue Aug 29, 2021 · 0 comments
Open

Feature suggestions (C# Moq inspiration) #1

Eldar1205 opened this issue Aug 29, 2021 · 0 comments

Comments

@Eldar1205
Copy link

Hi,

I looked at this open source library and want to say I really like the idea of finally having a type-hint oriented mocking library for Python so thank you! I'd like to suggest some features inspired by C# Moq library which looks very similar in design:

  1. Add a matcher for custom predicate, e.g. even integers predicate every(function_mock).with_args(pred(lambda x: x % 2 == 0)).returns(True). In case of verifications, the error message can include the code of the predicate itself, would be very useful.
  2. For returns add an option to return results based on a function of the input args, e.g. setup a function to return the negative of an integer: every(function_mock).returns(operator.neg) with def function_mock(param: int): pass
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

No branches or pull requests

1 participant