From 2cca88de394ff1fa3f85f9ee3585444552059da9 Mon Sep 17 00:00:00 2001 From: Eric Kolve Date: Fri, 30 Apr 2021 16:16:08 -0700 Subject: [PATCH] adding unit test for toggle on stove --- ai2thor/tests/test_unity.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ai2thor/tests/test_unity.py b/ai2thor/tests/test_unity.py index 38286c5300..16f0aa488b 100644 --- a/ai2thor/tests/test_unity.py +++ b/ai2thor/tests/test_unity.py @@ -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):