-1
I created a function in Python to return me a name of an object.
Before trying to use Switcher I did several variables as below:
name_case_1 = poco("Content").child("CaseItem(Clone)")[0].offspring("CaseName")
name_case_2 = poco("Content").child("CaseItem(Clone)")[1].offspring("CaseName")
name_case_3 = poco("Content").child("CaseItem(Clone)")[2].offspring("CaseName")
Then I created this function: case = 'THE TEACHER'
def validate_case_name(case):
switcher = {
case: 0,
case: 1,
case: 2,
}
return poco('Content').child("CaseItem(Clone)")[switcher.get(case)].offspring("CaseName").get_text()
case: 0 = THE TEACHER case: 1 = THE TEST case: 2 = THE CAR
But he always returns what is in [2] or 'THE CAR'. Could someone tell me how I could make this my function check if inside Switcher has the in "THE TEACHER"?
today my statement is like this:
assert_equal(context.cases.validate_case_name(case), 'THE TEACHER', 'OK')