def test_keep_in(): actor = Actor(0) actor.location[0] = -1 actor.location[1] = actor.battlefield_max() + 1 actor.keep_in() assert actor.location[0] == 0 assert actor.location[1] == actor.battlefield_max() actor.location[0] = actor.battlefield_max() + 1 actor.location[1] = -1 actor.keep_in() assert actor.location[0] == actor.battlefield_max() assert actor.location[1] == 0 actor.location[0] = 50 actor.location[1] = 50 actor.keep_in() assert actor.location[0] == 50 assert actor.location[1] == 50
def test_actor_location_xy_is_within_0_to_100(): actor = Actor(0) assert 0 <= actor.location[0] <= actor.battlefield_max() assert 0 <= actor.location[1] <= actor.battlefield_max()