Skip to content

Commit

Permalink
adding unit test for toggle on stove
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Kolve committed Apr 30, 2021
1 parent b9d5539 commit 2cca88d
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions ai2thor/tests/test_unity.py
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,25 @@ def test_open_aabb_cache(controller):
close_aabb = obj["axisAlignedBoundingBox"]
assert start_aabb["size"] == close_aabb["size"]

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_toggle_stove(controller):
position = {'x': -1.0, 'y': 0.9009982347488403, 'z': -2.25}
action = position.copy()
action["rotation"] = dict(y=90)
action["horizon"] = 30.0
action["standing"] = True
action["action"] = "TeleportFull"
event = controller.step(action, raise_for_failure=True)
knob = next(
obj
for obj in controller.last_event.metadata["objects"]
if obj["objectType"] == "StoveKnob" and obj['visible']
)
assert not knob['isToggled'], "knob should not be toggled"
assert knob['visible']
event = controller.step(dict(action='ToggleObjectOn', objectId=knob['objectId']), raise_for_failure=True)
knob = event.get_object(knob['objectId'])
assert knob['isToggled'], "knob should be toggled"

@pytest.mark.parametrize("controller", fifo_wsgi)
def test_open_interactable_with_filter(controller):
Expand Down

0 comments on commit 2cca88d

Please sign in to comment.