Created
November 8, 2017 17:47
-
-
Save dunossauro/8f7b001b5ba3612d5ace891a1e25f8ee to your computer and use it in GitHub Desktop.
import problemas with radish-bdd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from operator import add |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from radish import given, when, then | |
@given("I have the numbers {number1:g} and {number2:g}") | |
def have_numbers(step, number1, number2): | |
step.context.number1 = number1 | |
step.context.number2 = number2 | |
@when("I sum them") | |
def sum_numbers(step): | |
step.context.result = step.context.calculator.add(step.context.number1, | |
step.context.number2) | |
@then("I expect the result to be {result:g}") | |
def expect_result(step, result): | |
assert step.context.result == result |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from radish import before, after | |
import calc | |
# from calc import calculator | |
@before.each_scenario | |
def init_calculator(scenario): | |
scenario.context.calculator = calc.calculator | |
# scenario.context.calculator = calculator | |
@after.each_scenario | |
def destory_calculator(scenario): | |
del scenario.context.calculator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
. | |
├── calc | |
│ ├── calculator.py | |
│ └── __init__.py | |
├── features | |
│ └── SumNumbers.feature | |
└── radish | |
├── __init__.py | |
├── steps.py | |
└── terrain.py |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment