style: ruff format + stronger sqlite asserts (delete utils, drop test_no_gng)
This commit is contained in:
+19
-5
@@ -1,6 +1,8 @@
|
||||
import uuid
|
||||
from agentmsgs.core.types import Agent, Thread, Message
|
||||
import datetime
|
||||
import uuid
|
||||
|
||||
from agentmsgs.core.types import Agent, Thread
|
||||
|
||||
|
||||
def test_agent_identity_on_id_not_name():
|
||||
a1 = Agent(id=uuid.uuid4(), name="Alice")
|
||||
@@ -8,17 +10,29 @@ def test_agent_identity_on_id_not_name():
|
||||
assert a1 != a2 # different id => not equal even though name same
|
||||
assert hash(a1) != hash(a2)
|
||||
|
||||
|
||||
def test_agent_hash_on_id():
|
||||
uid = uuid.uuid4()
|
||||
a1 = Agent(id=uid, name="Alice")
|
||||
a2 = Agent(id=uid, name="Bob") # same id, different name => equal per design (id is identity)
|
||||
a2 = Agent(
|
||||
id=uid, name="Bob"
|
||||
) # same id, different name => equal per design (id is identity)
|
||||
assert a1 == a2
|
||||
assert hash(a1) == hash(a2)
|
||||
|
||||
|
||||
def test_thread_multiple_with_same_participants_allowed():
|
||||
a = Agent(id=uuid.uuid4(), name="A")
|
||||
b = Agent(id=uuid.uuid4(), name="B")
|
||||
t1 = Thread(id=uuid.uuid4(), participants=frozenset({a,b}), created_at=datetime.datetime.now(datetime.timezone.utc))
|
||||
t2 = Thread(id=uuid.uuid4(), participants=frozenset({a,b}), created_at=datetime.datetime.now(datetime.timezone.utc))
|
||||
t1 = Thread(
|
||||
id=uuid.uuid4(),
|
||||
participants=frozenset({a, b}),
|
||||
created_at=datetime.datetime.now(datetime.UTC),
|
||||
)
|
||||
t2 = Thread(
|
||||
id=uuid.uuid4(),
|
||||
participants=frozenset({a, b}),
|
||||
created_at=datetime.datetime.now(datetime.UTC),
|
||||
)
|
||||
assert t1 != t2
|
||||
assert t1.participants == t2.participants
|
||||
|
||||
Reference in New Issue
Block a user