From a7312d4cb2456f0ce3d1d5510320c4e12f755be7 Mon Sep 17 00:00:00 2001 From: fheinrich <fheinrich@techfak.de> Date: Fri, 8 Mar 2024 17:09:54 +0100 Subject: [PATCH] Fix tests --- .../configs/environment_config.yaml | 8 +----- tests/test_cooking_equipment.py | 26 ++++++++++--------- tests/test_counter.py | 2 +- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/cooperative_cuisine/configs/environment_config.yaml b/cooperative_cuisine/configs/environment_config.yaml index 0fc403cd..eec7ad50 100644 --- a/cooperative_cuisine/configs/environment_config.yaml +++ b/cooperative_cuisine/configs/environment_config.yaml @@ -207,13 +207,7 @@ extra_setup_functions: log_path: USER_LOG_DIR/ENV_NAME/LOG_RECORD_NAME.jsonl add_hook_ref: true - empty_info_msg: - func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class '' - kwargs: - hooks: [ action_put ] - callback_class: !!python/name:cooperative_cuisine.info_msg.InfoMsgManager '' - callback_class_kwargs: - msg: "" + # info_msg: # func: !!python/name:cooperative_cuisine.hooks.hooks_via_callback_class '' # kwargs: diff --git a/tests/test_cooking_equipment.py b/tests/test_cooking_equipment.py index 03f936f1..60377d83 100644 --- a/tests/test_cooking_equipment.py +++ b/tests/test_cooking_equipment.py @@ -1,5 +1,6 @@ import pytest +from cooperative_cuisine.hooks import Hooks from cooperative_cuisine.items import ItemInfo, CookingEquipment, Item, ItemType @@ -8,7 +9,7 @@ def test_can_combine_single_other_item(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) other_item = Item("Onion", ItemInfo(type=ItemType.Ingredient, name="Onion")) @@ -20,12 +21,13 @@ def test_can_combine_list_of_other_items(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) other_item = CookingEquipment( name="Pan", transitions={}, item_info=ItemInfo(type=ItemType.Equipment, name="Pan"), + hook=Hooks(None) ) assert cooking_equipment.can_combine(other_item) == False @@ -36,7 +38,7 @@ def test_can_combine_without_other_item(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) assert cooking_equipment.can_combine(None) == False @@ -47,7 +49,7 @@ def test_combine(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) other_item = Item("Onion", ItemInfo(type=ItemType.Ingredient, name="Onion")) @@ -59,7 +61,7 @@ def test_progress(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) result = Item(name="TestResult", item_info=None) cooking_equipment.active_transition = { @@ -78,7 +80,7 @@ def test_reset_content(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) cooking_equipment.content_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] cooking_equipment.reset_content() @@ -91,7 +93,7 @@ def test_release(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) cooking_equipment.content_list = ["Content1", "Content2"] @@ -105,7 +107,7 @@ def test_extra_repr_without_content(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) assert cooking_equipment.extra_repr == "[], None" @@ -116,7 +118,7 @@ def test_extra_repr_with_content(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) item_1 = Item( @@ -135,7 +137,7 @@ def test_get_potential_meal_without_content(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) assert cooking_equipment.get_potential_meal() is None @@ -146,7 +148,7 @@ def test_get_potential_meal_with_content(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) cooking_equipment = CookingEquipment( - transitions={}, name="Pot", item_info=item_info + transitions={}, name="Pot", item_info=item_info, hook=Hooks(None) ) item_1 = Item( @@ -166,7 +168,7 @@ def test_get_potential_meal_with_content(): @pytest.fixture def cooking_equipment(): item_info = ItemInfo(type=ItemType.Meal, name="Soup", seconds=5.0) - return CookingEquipment(transitions={}, name="Pot", item_info=item_info) + return CookingEquipment(transitions={}, name="Pot", item_info=item_info, hook=Hooks(None)) def test_reset(cooking_equipment): diff --git a/tests/test_counter.py b/tests/test_counter.py index d6860acb..058a9e17 100644 --- a/tests/test_counter.py +++ b/tests/test_counter.py @@ -35,7 +35,7 @@ def test_serving_window(): plate_dispenser.plate_received ), "ServingWindow needs to update plate out of kitchen for ordered meal." plate_dispenser.plate_received = False - plate = Plate(transitions={}, clean=True, item_info=None) + plate = Plate(transitions={}, clean=True, item_info=None, hook=Hooks(None)) plate.content_list = [Item(name="TestMeal", item_info=None)] assert serving_window.can_drop_off( item=plate -- GitLab