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

Extend matchers and refactor #7

Closed
5 tasks done
bdsoha opened this issue Nov 29, 2022 · 5 comments
Closed
5 tasks done

Extend matchers and refactor #7

bdsoha opened this issue Nov 29, 2022 · 5 comments

Comments

@bdsoha
Copy link
Owner

bdsoha commented Nov 29, 2022

I would like to propose a few additions and refactors (with your approval, I can begin working on them):

@petereon
Copy link
Collaborator

All, 1., 2. and 4. sound great, I have nothing to add there.
On 3rd point I have just few clarifying questions:

  • to_have_attributes() is going to take a list of names of expected attributes as arguments?
  • What is to_almost_equal() meaning to match? Numeric similarity with some sort of acceptable delta?

Your changes are very welcome!

@bdsoha
Copy link
Owner Author

bdsoha commented Nov 29, 2022

Regarding to_have_attributes, I imaging the following overloaded signatures:

def to_have_attribute(self, key: str):
    ...

def to_have_attribute(self, key: str, value: Any):
    ...

def to_have_attributes(self, *keys: str):
    ...

An explanation of to_almost_equal from the Python's built-in unittest package.

@petereon
Copy link
Collaborator

Both sound great! Looking forward to the PR(s)!

@bdsoha
Copy link
Owner Author

bdsoha commented Nov 29, 2022

@petereon Before I get started, one more question, is there a reason why you split alias and negated test into separate methods?

Example:

  • test_to_contain_subfolder
  • test_to_contain_subfolder_failing
  • test_to_not_contain_subfolder
  • test_to_not_contain_subfolder_failing

@petereon
Copy link
Collaborator

@bdsoha Yes, it's for legacy reasons, there have previously been separate implementations for negated matchers. Aliases don't necessarily make sense, I agree. As it is it would presumably make more sense to test just the __init__ method that it negates correctly.

@bdsoha bdsoha changed the title Extend matchers Extend matchers and refactor Dec 1, 2022
@bdsoha bdsoha closed this as completed Dec 8, 2022
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

2 participants