Skip to content

TEST: Add unit tests for pyrit/memory/memory_models.py#1598

Open
romanlutz wants to merge 1 commit intomicrosoft:mainfrom
romanlutz:test/memory-coverage
Open

TEST: Add unit tests for pyrit/memory/memory_models.py#1598
romanlutz wants to merge 1 commit intomicrosoft:mainfrom
romanlutz:test/memory-coverage

Conversation

@romanlutz
Copy link
Copy Markdown
Contributor

Summary

Adds comprehensive unit tests for the memory model classes.

New Test File

\ ests/unit/memory/test_memory_models.py\ — 36 tests covering:

  • _ensure_utc\ helper (None, naive, aware datetime handling)
  • \ConversationMessageWithSimilarity\ / \EmbeddingMessageWithSimilarity\
  • \PromptMemoryEntry\ (init, converter storage, null identifiers, roundtrip, str)
  • \ScoreEntry\ (init, roundtrip, to_dict)
  • \EmbeddingDataEntry\ (str)
  • \SeedEntry\ (prompt init, objective init, roundtrips, parameter preservation)
  • \AttackResultEntry\ (init, conversation refs, UUID handling, JSON serialization)
  • \ScenarioResultEntry\ (init, roundtrip, conversation IDs)

Testing

All 36 tests pass locally.

Tests memory model classes including:
- _ensure_utc helper
- PromptMemoryEntry, ScoreEntry, EmbeddingDataEntry
- SeedEntry, AttackResultEntry, ScenarioResultEntry
- Roundtrip conversions and field preservation

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant