test: bunch of tests
Written with AI, still need to check them ref: N25B-449
This commit is contained in:
24
test/unit/agents/test_base.py
Normal file
24
test/unit/agents/test_base.py
Normal file
@@ -0,0 +1,24 @@
|
||||
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"
|
||||
Reference in New Issue
Block a user