""" This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences) """ import logging from control_backend.agents.base import BaseAgent class MyAgent(BaseAgent): async def setup(self): pass async def handle_message(self, msg): pass def test_base_agent_logger_init(): # When defining a subclass, __init_subclass__ runs # The BaseAgent in agents/base.py sets the logger assert hasattr(MyAgent, "logger") assert isinstance(MyAgent.logger, logging.Logger) # The logger name depends on the package. # Since this test file is running as a module, __package__ might be None or the test package. # In 'src/control_backend/agents/base.py', it uses __package__ of base.py which is # 'control_backend.agents'. # So logger name should be control_backend.agents.MyAgent assert MyAgent.logger.name == "control_backend.agents.MyAgent"