-
Notifications
You must be signed in to change notification settings - Fork 74
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
Provide possibility to extend sure. Refs #31 #117
Provide possibility to extend sure. Refs #31 #117
Conversation
@gabrielfalcao Would you prefer to pass important values to the The interface would then look like: @assertion
def return_code(self, what, is_negative, return_code):
pass This would have the benefit that the user does not need to know the However, with that the user is kinda limited to those values - even worse would be if the user would not need the passed values but instead needs to access something from |
ccab0ae
to
a2db762
Compare
def assertion(func): | ||
"""Extend sure with a custom assertion method.""" | ||
func = assertionmethod(func) | ||
setattr(AssertionBuilder, func.__name__, func) |
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.
Maybe don't use setattr
but registration of assertion into a dict and then use __getattr__
...?
a2db762
to
7f515b9
Compare
return self.obj.headers[header_name] | ||
|
||
|
||
# FIXME(TF): 'must' does not sound right in this method chain. |
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.
@gabrielfalcao what do you think about adding a which
or having
to the list of POSITIVES
for the monkey patched PyObject properties?
7f515b9
to
8e5e054
Compare
8e5e054
to
70d4461
Compare
This developer experience is fantastic. |
Note: work in progress
This PR contains the following features:
Other Todos:
Exception
:class Assertion(AssertionError): pass
which takes expected and given arguments? Is it just best practice?Custom assertion example
@gabrielfalcao please provide feedback regarding API. See first test for entire example usage.
Refs: #31