0

i pass coordinates -40 and -40 to a method like below and the robot test is as below

Test something
    asset_something -40 -40

So in the above statement -40 and -40 are treated as strings.

assert_something (-40, -40) {
    xcoord = (location['x'] + element.size['width'] /2) - 
    (canvas.location['x'] + canvas.size['width'] / 2)
    ycoord = (location['y'] + element.size['height'] /2) 
    (canvas.location['y'] + canvas.size['height'] // 2)
    assert xcoord == -40
    assert ycoord == -40
}

Here in the above method the value of xcoord and ycoord is -40.0 so i get an assertion error since i am comparing -40.0 to -40

how can do the assertion that both are equal..i tried below

xcoord = int(location['x'] + element.size['width'] /2) - (canvas.location['x'] + 
    canvas.size['width'] 
    / 2)
    ycoord = int(location['y'] + element.size['height'] /2) - (canvas.location['y'] + 
    canvas.size['height'] // 2)

but it was converting only ycoord to -40 but xcoord value remained to be -40.0 how can i fix this. thanks.

someuser2491
  • 1,848
  • 5
  • 27
  • 63

0 Answers0