cantabile_edge, cantabile_modbus, cantabile_eebus 0.1.400: full source

This commit is contained in:
Setti Solutions S.R.L committed 2026-10-30 08:26:45 +02:00
1 parent 343331d234
commit d5fbcacaa4
176 files changed
+32511 -19

No files matched your search

+32
View File
@@ -0,0 +1,32 @@
# Copyright © 2026 Setti Solutions S.R.L, www.setti.md. All rights reserved.
from cantabile_edge.store import Queue
def test_order_ack_and_no_reuse(tmp_path):
q = Queue(str(tmp_path / "q.db"), 100)
seqs = [q.put("tel", {"i": i}) for i in range(5)]
assert seqs == sorted(seqs)
assert [p["i"] for _, _, p in q.peek(3)] == [0, 1, 2]
q.ack(seqs[1])
assert [s for s, _, _ in q.peek()] == seqs[2:]
q.ack(seqs[-1])
assert q.depth() == 0
assert q.put("tel", {}) > seqs[-1] # a number is never used twice
def test_survives_reopen(tmp_path):
p = str(tmp_path / "q.db")
q = Queue(p, 100)
q.put("tel", {"a": 1})
q.put("stats", {"b": 2})
q.close()
q = Queue(p, 100)
assert [(k, d) for _, k, d in q.peek()] == [("tel", {"a": 1}), ("stats", {"b": 2})]
def test_bounded_drops_oldest_and_counts(tmp_path):
q = Queue(str(tmp_path / "q.db"), 3)
for i in range(5):
q.put("tel", {"i": i})
assert [p["i"] for _, _, p in q.peek()] == [2, 3, 4]
assert q.dropped() == 2