Dingus call matcher for should-dsl
Project description
This modules contains a custom matcher so you can use should_dsl with Dingus calls
A small warning: The | operator hack of should_dsl’s doesn’t really go well with the __or__() of a Dingus. I think the | hack is nasty, and I’m not sure I like should_dsl for it. This is where Ruby seems really pretty to me.
You only need to import it
>>> from should_dsl import should, should_not >>> from dingus import Dingus >>> import should_dingus
call
Checks calls on a Dingus
>>> stub = Dingus('stub')
>>> def some_function():
... stub()
...
>>> some_function |should| call(stub)
call can also check that it should be called once:
>>> def some_function(): ... stub() ... stub() ... >>> some_function |should| call(stub) >>> some_function |should| call(stub).once Traceback (most recent call last): ... ShouldNotSatisfied: <Dingus stub> was called 2 times, expected 1
call can even check the parameters with with_params:
>>> def some_function():
... stub(True, kwak='tuut', braat='aap')
...
>>> some_function |should| call(stub).with_params(True, kwak='tuut', braat='aap')
>>> some_function |should| call(stub).with_params(True, kwak='tuut')
Traceback (most recent call last):
...
ShouldNotSatisfied: <Dingus stub> has not been called with params (True,) {'kwak': 'tuut'}
call with_params can be combined with once:
>>> def some_function(): ... stub(True, kwak='tuut', braat='aap') ... >>> some_function |should| call(stub).once.with_params(True, kwak='tuut', braat='aap') >>> stub.reset() >>> some_function |should| call(stub).with_params(True, kwak='tuut', braat='aap').once
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
should-dingus-0.1.tar.gz
(2.2 kB
view details)
File details
Details for the file should-dingus-0.1.tar.gz.
File metadata
- Download URL: should-dingus-0.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8846a7eb9b337272aba3a4537e060b037668ae3cb6e4c6d78e74383f2cf5ff99
|
|
| MD5 |
bc660dae00394b804e2b09d63475e7c5
|
|
| BLAKE2b-256 |
b122418feea6a732b5b44813d3ebcb96e81160d947382158652ffa4a57abffe3
|