Files
Celes Renata 57619860d5 feat: implement DCOS source tree, tests, and build configuration
Complete implementation of the DCOS package including:
- 40+ Python source files across agents, communication, core, learning, memory, protocols, utils
- pyproject.toml build configuration
- 102 unit tests across all subsystems
- Fixed flake.nix (Python 3.12, proper dependencies, pyproject build)
- Fixed .woodpecker.yml (correct paths, removed silent-fail flags)
- Added .gitignore
- Cleared stale pytest cache
2026-08-02 03:29:55 -07:00

30 lines
812 B
Python

"""
Tests for EthicsAgent.
"""
import pytest
from dcos.agents.ethics import EthicsAgent, EthicalConstraint
class TestEthicsAgent:
def test_validate_ethical(self):
agent = EthicsAgent()
result = agent.validate("help the user")
assert len(result) == 0
def test_validate_unethical(self):
agent = EthicsAgent()
result = agent.validate("deceive the user")
assert len(result) > 0
def test_add_constraint(self):
agent = EthicsAgent()
before = len(agent._constraints)
agent.add_constraint(EthicalConstraint.BENEFICENCE)
assert len(agent._constraints) == before # already present
def test_act(self):
agent = EthicsAgent()
result = agent.act({"action": "help"})
assert result["ethical"] is True