Repository navigation
Closed
Labels
Description
Second wave of pure-logic unit tests for the mellea library, following up on the completed children (#812–#817) of the coverage epic (#813).
Goal
Cover every remaining pure-logic gap across the library that doesn't require live backends, GPU, or optional infrastructure (OTel, cpex). All tests should:
- Run in the default
pytestinvocation (no marker flags needed) - Zero backend, network, or optional-dep dependencies (except where explicitly guarded with
require_*predicates) - Test behavioural contracts, not implementation internals
Target areas
| Area | What to test |
|---|---|
stdlib/components/simple.py |
Init, type validation, make_simple_string, make_json_string, format_for_llm |
stdlib/components/instruction.py |
Init, Jinja2 user_variables, parts(), format_for_llm(), copy_and_repair |
stdlib/components/chat.py |
Message init/parts/_parse (Ollama/OpenAI/fallback paths), ToolMessage, as_chat_history |
stdlib/components/genstub.py |
describe_function, get_argument, bind_function_arguments, create_response_format, format_for_llm, Arguments, ArgPreconditionRequirement, _parse |
stdlib/components/mobject.py |
Query/Transform/MObject parts, format_for_llm, _parse, custom types |
stdlib/functional.py |
_parse_and_clean_image_args |
stdlib/sampling/majority_voting.py |
compare_strings (math + RougeL) |
stdlib/sampling/sofai.py |
_parse_judgment, _extract_feedback, _extract_action_prompt, _select_best_attempt |
stdlib/sampling/base.py |
RepairTemplateStrategy.repair() |
stdlib/session.py |
backend_name_to_class, get_session error path |
telemetry/backend_instrumentation.py |
get_model_id_str, get_system_name, get_context_size, record_token_usage, record_response_metadata |
telemetry/tracing.py |
_set_attribute_safe type conversions, set_span_error, end_backend_span |
backends/utils.py |
get_value, to_tool_calls, to_chat |
backends/openai.py |
filter_*_kwargs, _simplify_and_merge, _make_backend_specific_and_remove |
backends/ollama.py |
_simplify_and_merge, _make_backend_specific_and_remove, chat_response_delta_merge |
formatters/granite/base/util.py |
find_substring_in_text |
core/base.py |
CBlock error paths, ImageBlock validation, MOT._copy_from |
core/requirement.py |
ValidationResult properties, default_output_to_bool |
Out of scope
| Area | Reason |
|---|---|
stdlib/requirements/safety/guardian.py (157 stmts) |
Deprecated |
stdlib/sampling/budget_forcing* |
Calls backend.generate_from_raw() — not pure logic |
backends/ generate/stream paths |
Require live backend connections |
plugins/ |
cpex optional-dep registration |
telemetry/ OTel bootstrap |
Only runs when OTel configured |
Principles
- Prioritise contract tests over implementation tests — test what callers can observe
- Use
require_nltk_data()/require_package()predicates, notpytest.importorskipat module level, when only some tests in a file need optional deps - Tests that access
_prefixed fields are acceptable only when no public accessor exists; document with a comment
Activity
test: add pure-logic unit tests for stdlib, core, backends, telemetry
test: pure-logic unit tests for stdlib, core, backends, telemetry (#860…
test: pure-logic unit tests for stdlib, core, backends, telemetry (ge…