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

37 lines
1.0 KiB
Python

"""
Tests for CommunicationNetwork.
"""
import pytest
from dcos.communication.network import CommunicationNetwork
from dcos.communication.protocol import Message
class TestCommunicationNetwork:
def test_connect_and_deliver(self):
net = CommunicationNetwork()
net.connect("a", "b")
msg = Message(sender="a", recipient="b", payload="test")
assert net.deliver(msg) is True
def test_disconnect(self):
net = CommunicationNetwork()
net.connect("a", "b")
net.disconnect("a", "b")
msg = Message(sender="a", recipient="b", payload="test")
assert net.deliver(msg) is False
def test_broadcast(self):
net = CommunicationNetwork()
net.connect("a", "b")
net.connect("a", "c")
count = net.broadcast("a", "broadcast message")
assert count == 2
def test_get_peers(self):
net = CommunicationNetwork()
net.connect("x", "y")
net.connect("x", "z")
peers = net.get_peers("x")
assert len(peers) == 2