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

include a is_subset assert method #6367

Closed
ssbarnea opened this issue Dec 25, 2019 · 4 comments
Closed

include a is_subset assert method #6367

ssbarnea opened this issue Dec 25, 2019 · 4 comments

Comments

@ssbarnea
Copy link
Member

I think it is common to want to assert that a nested dictonary is a subset of another one and it would be very useful to add such an assert function to pytest itself.

One good example is at https://stackoverflow.com/a/57675231/99834

@asottile
Copy link
Member

pytest doesn't currently house any assertion functions -- this would be better done in some assertion library or plugin

@ssbarnea
Copy link
Member Author

@asottile I was afraid that this may be the case. Now the big question is if there is another existing library or plugin which could host this assertion. I do really want to avoid creating another project for it.

@nicoddemus
Copy link
Member

While @asottile is correct, I do wonder if we should perhaps have an official assertion library/plugin, as it solves practical problems. Immediately comes to mind how often I use fnmatch_lines even though it is private.

But before we introduce assertions, I would like to see a possible list of "assertion helpers" that should be included, so we can take a look at the landscape and decide if this should be indeed a separate library (perhaps under pytest-dev directly) or introduced into pytest itself (I tend for the former, as it doesn't depend on the internals and might have a different release cycle than the core).

This has been brought up before: #2376

@nicoddemus
Copy link
Member

@ssbarnea I'm closing this now, let's continue this in #2376

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

3 participants