コード例 #1
0
    def test_track_spawned_entities(self):
        self.begin_for_testing()
        pen_down(living.OCELOT)
        forward(2)

        self.assertEqual({
            "uuid1": living.OCELOT,
            "uuid2": living.OCELOT
        }, living_things())
コード例 #2
0
    def test_living_entity_tasks(self):
        self.begin_for_testing()
        pen_down(living.OCELOT)
        forward(2)
        pen_down(living.WOLF)
        forward(1)

        self.assertEqual(
            {
                "uuid1": living.OCELOT,
                "uuid2": living.OCELOT,
                "uuid3": living.WOLF
            }, living_things())

        start_task(living.OCELOT.SIT)

        self.assertEqual([("uuid1", "sit"), ("uuid2", "sit")],
                         sorted(self.game.entity.tasks_in_progress)
                         )  # by default, only ocelots are selected

        reset_task(living.OCELOT.SIT)

        self.assertEqual([], self.game.entity.tasks_in_progress)