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

Assert only on dictionary value #59

Closed
rix0rrr opened this issue Aug 4, 2020 · 2 comments
Closed

Assert only on dictionary value #59

rix0rrr opened this issue Aug 4, 2020 · 2 comments

Comments

@rix0rrr
Copy link

rix0rrr commented Aug 4, 2020

The only assertions that work with dicts are, as far as I can see:

{ 'foo': 'bar' } | should.have.key('foo')

Is there also something like:

{ 'foo': 'bar' } | should.have.value('bar')

In fact, what I want is additional assertions applied to each of the values, so I want something like:

{ 'foo': 'bar' } | should.have.value() > should.have.length(3)

If not, is it possible for me to add an assertion like that?

@h2non
Copy link
Member

h2non commented Aug 4, 2020

There is no built-in values operator, but it can be easily created based on the keys operator.

@h2non h2non closed this as completed in 074d0fe Nov 21, 2020
h2non added a commit that referenced this issue Nov 21, 2020
Fixes #53, #55, #48, #59 (partially) and added mock call operators
@sgissinger
Copy link
Contributor

@rix0rrr Operator contain has been upgraded to work with dictionaries

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants