grappa-py / grappa

Behavior-oriented, expressive, human-friendly Python assertion library for the 21st century
http://grappa.rtfd.io
MIT License
134 stars 15 forks source link

Should correct #55 #63

Closed sgissinger closed 3 years ago

sgissinger commented 3 years ago

I used the following to test and it seems to be good

expect({'bar': True}).to_not.have.key('foo')
expect({'bar': True}).to.have.key('bar')

expect({'bar': True, 'bor': 0}).to.not_have.key('foo')
expect({'bar': True, 'bur': 'yop'}).to.have.key('bar')

expect({'bar': True, 'bor': 0}).to.not_have.keys('foo', 'fuu')
expect({'bar': True, 'bur': 'yop'}).to.have.keys('bar', 'bur')

expect(lambda: expect({'bar': True, 'bor': 0}).to.have.key('foo')).to.raise_error(AssertionError)
expect(lambda: expect({'bar': True, 'bur': 'yop'}).to.not_have.key('bur')).to.raise_error(AssertionError)

expect(lambda: expect({'bar': True, 'bor': 0}).to.have.keys('foo', 'fuu')).to.raise_error(AssertionError)
expect(lambda: expect({'bar': True, 'bor': 0}).to.have.keys('bar', 'fuu')).to.raise_error(AssertionError)
expect(lambda: expect({'bar': True, 'bur': 'yop'}).to.not_have.keys('bar', 'bur')).to.raise_error(AssertionError)
sgissinger commented 3 years ago

Non-sense :) Will work with projet TU before submitting something for this bug