Skip to content

Write unit tests for memory_manager and contradiction_agent #4

@blackboxprogramming

Description

@blackboxprogramming

Description

The memory_manager and contradiction_agent modules provide essential functionality for Lucidia but currently lack automated tests. Adding unit tests will ensure stability as new features are added.

Proposed work

  • Create a tests/ directory in the Lucidia repository and set up pytest as the test runner.
  • Write tests for the MemoryManager class:
    • Verify that load_memory returns an empty dictionary when the memory file does not exist or contains malformed JSON.
    • Test that save_memory persists data correctly and that MemoryManager.get, set, and delete operations work as expected.
  • Write tests for the ContradictionAgent class:
    • Confirm that analyze appends contradictions to the list and writes them to contradictions.json.
    • Test list_contradictions and clear_contradictions to ensure they return and clear the stored contradictions appropriately.
  • Use fixtures or temporary directories to isolate file I/O during tests so that the real memory files are not affected.

Acceptance criteria

  • Running pytest in the Lucidia repository executes all tests and they pass without errors.
  • Tests cover both typical and edge-case behaviors for memory loading/saving and contradiction logging/clearing.
  • Tests run in an isolated environment without modifying existing memory or contradiction files.
  • A brief README or comment explains how to run the tests.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions