| 1 |
TODO |
| 2 |
---- |
| 3 |
|
| 4 |
``.when.py2.should.`` and ``.should.when.py2.`` |
| 5 |
``.when.py3.should.`` and ``.should.when.py3.`` |
| 6 |
|
| 7 |
|
| 8 |
Mock and Stubbing support |
| 9 |
~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 10 |
|
| 11 |
|
| 12 |
.. code:: python |
| 13 |
|
| 14 |
import sure |
| 15 |
|
| 16 |
|
| 17 |
def some_helper_function(value): |
| 18 |
if value == 'foo': |
| 19 |
return 'expected' |
| 20 |
|
| 21 |
|
| 22 |
def main_function_that_depends_on_helper(param1, param2): |
| 23 |
return some_helper_function(param1) |
| 24 |
|
| 25 |
|
| 26 |
def test_main_function_succeeds_when_helper_returns_expected_result(): |
| 27 |
some_helper_function.stub.called_with('foo').returns(['expected']) |
| 28 |
|
| 29 |
result = main_function_that_depends_on_helper('foo', 'bar') |
| 30 |
|
| 31 |
result.should.equal('expected') |