From a56777edb933e8a346791b0ebdd2800f209ec4ff Mon Sep 17 00:00:00 2001 From: SereneWalden <22496084+SereneWalden@users.noreply.github.com> Date: Wed, 4 Oct 2023 21:01:17 +0800 Subject: [PATCH] add tests/roles/ --- examples/st_game/tests/roles/__init__.py | 3 +++ examples/st_game/tests/roles/test_st_role.py | 16 ++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 examples/st_game/tests/roles/__init__.py create mode 100644 examples/st_game/tests/roles/test_st_role.py diff --git a/examples/st_game/tests/roles/__init__.py b/examples/st_game/tests/roles/__init__.py new file mode 100644 index 000000000..2bcf8efd0 --- /dev/null +++ b/examples/st_game/tests/roles/__init__.py @@ -0,0 +1,3 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +# @Desc : diff --git a/examples/st_game/tests/roles/test_st_role.py b/examples/st_game/tests/roles/test_st_role.py new file mode 100644 index 000000000..35bc6fbb6 --- /dev/null +++ b/examples/st_game/tests/roles/test_st_role.py @@ -0,0 +1,16 @@ +from examples.st_game.roles.st_role import STRole, STRoleContext +from examples.st_game.memory.agent_memory import BasicMemory + +role = STRole(start_date="October 4, 2023", curr_time="October 4, 2023, 00:00:00", + sim_code="base_the_ville_isabella_maria_klaus") + +def test_role_init(): + assert role.role_tile == (126, 46) + assert role._rc.env.maze.maze_height == 100 + assert role._rc.env.maze.maze_width == 140 + +def test_observe(): + ret_events = role.observe() + assert ret_events + for event in ret_events: + assert isinstance(event, BasicMemory) \ No newline at end of file