Option C Tools
Loading...
Searching...
No Matches
tests_core.test_octrc_safe Namespace Reference

Functions

 test_missing_file_returns_empty (Path tmp_path)
 test_valid_object_returns_dict (Path tmp_path)
 test_invalid_json_returns_error (Path tmp_path)
 test_non_object_top_level_returns_error (Path tmp_path)

Detailed Description

Purpose
-------
OI-519 regression tests — :func:`oct.core.octrc.load_octrc` and its silent
wrapper :func:`load_octrc_safe` must be the single source of truth for
``.octrc.json`` reads. This test exercises the contract that multiple
historical readers (linter, formatter, health, typecheck) now rely on.

Responsibilities
----------------
- Missing file → ``({}, [])``; ``load_octrc_safe`` → ``{}``.
- Valid JSON object → parsed dict, no errors.
- Invalid JSON → ``({}, [<error>])``.
- Non-object top-level JSON (e.g. a list) → ``({}, [<error>])``.
- OSError on read → ``({}, [<error>])``.

Diagnostics
-----------
Domain: CORE-TESTS
Levels:
    L2 — test lifecycle
    L3 — assertion details
    L4 — deep tracing

Contracts
---------
- All file reads and writes use ``tmp_path``; no real ``.octrc.json``
  is touched.

Function Documentation

◆ test_invalid_json_returns_error()

tests_core.test_octrc_safe.test_invalid_json_returns_error ( Path tmp_path)

Definition at line 58 of file test_octrc_safe.py.

◆ test_missing_file_returns_empty()

tests_core.test_octrc_safe.test_missing_file_returns_empty ( Path tmp_path)

Definition at line 41 of file test_octrc_safe.py.

◆ test_non_object_top_level_returns_error()

tests_core.test_octrc_safe.test_non_object_top_level_returns_error ( Path tmp_path)

Definition at line 68 of file test_octrc_safe.py.

◆ test_valid_object_returns_dict()

tests_core.test_octrc_safe.test_valid_object_returns_dict ( Path tmp_path)

Definition at line 48 of file test_octrc_safe.py.