34 lines
931 B
Python
34 lines
931 B
Python
|
|
"""Tests for the bounded context collector (T02 + T07).
|
||
|
|
|
||
|
|
Focus on the hard constraints:
|
||
|
|
- Never recurses.
|
||
|
|
- Respects the ignore list for dangerous/expensive locations.
|
||
|
|
- Always produces a serializable envelope with provenance.
|
||
|
|
"""
|
||
|
|
|
||
|
|
from cya.context.collector import collect, ContextEnvelope
|
||
|
|
|
||
|
|
|
||
|
|
def test_collect_returns_envelope():
|
||
|
|
env = collect(".")
|
||
|
|
assert isinstance(env, ContextEnvelope)
|
||
|
|
assert env.cwd
|
||
|
|
assert isinstance(env.top_level, list)
|
||
|
|
assert env.collected_at
|
||
|
|
|
||
|
|
|
||
|
|
def test_collect_is_non_recursive_and_filters():
|
||
|
|
env = collect(".")
|
||
|
|
# We should never have deep nested paths in top_level for this collector
|
||
|
|
for entry in env.top_level:
|
||
|
|
assert "/" not in entry.get("name", "")
|
||
|
|
assert "\\" not in entry.get("name", "")
|
||
|
|
|
||
|
|
|
||
|
|
def test_collect_is_serializable():
|
||
|
|
env = collect(".")
|
||
|
|
d = env.to_dict()
|
||
|
|
assert isinstance(d, dict)
|
||
|
|
assert "cwd" in d
|
||
|
|
assert "top_level" in d
|