I have written a Step pattern directly in the python without class definition. But i want to write for class with regular expression?
It is given the pattern must be in the doc string so i tried giving the regular expression but it didn't work.
With out Class definition
@given(re.compile(r"I have the scripts (.*) hello"))
def step_impl(step,number):
"""
:type context behave.runner.Context
"""
print("Number",number)
With Class definition i have tried like
from radish import steps, given
import re
@steps
class Calculator:
def have_number(self, step, number):
"""@given(re.compile(r"I have the scripts (.*) hello"))"""
print("HELLO",number)
print("KHJH")
But it is not working.
I want a method from which i can accept the regular expression in the class based definition
Aucun commentaire:
Enregistrer un commentaire