Private
Public Access
feat(type_aliases): add 10 TypeAliases + FileItemsDiff NamedTuple
This commit is contained in:
+16
-13
@@ -1,38 +1,41 @@
|
||||
from __future__ import annotations
|
||||
from typing import Any, Callable, get_type_hints
|
||||
from typing import Any, Callable, NamedTuple, TypeAlias, get_type_hints
|
||||
import pytest
|
||||
from src import type_aliases
|
||||
from src import result_types
|
||||
|
||||
|
||||
def test_metadata_alias_resolves_to_dict() -> None:
|
||||
hints = get_type_hints(type_aliases)
|
||||
assert hints["Metadata"] == dict[str, Any]
|
||||
assert type_aliases.Metadata == dict[str, Any]
|
||||
|
||||
|
||||
def test_comms_log_entry_alias_resolves_to_metadata() -> None:
|
||||
hints = get_type_hints(type_aliases)
|
||||
assert hints["CommsLogEntry"] == dict[str, Any]
|
||||
assert type_aliases.CommsLogEntry is type_aliases.Metadata
|
||||
assert type_aliases.CommsLogEntry == dict[str, Any]
|
||||
|
||||
|
||||
def test_comms_log_alias_resolves_to_list_of_comms_log_entry() -> None:
|
||||
hints = get_type_hints(type_aliases)
|
||||
assert hints["CommsLog"] == list[dict[str, Any]]
|
||||
assert type_aliases.CommsLog == list[dict[str, Any]]
|
||||
|
||||
|
||||
def test_history_alias_resolves_to_list_of_history_message() -> None:
|
||||
hints = get_type_hints(type_aliases)
|
||||
assert hints["History"] == list[dict[str, Any]]
|
||||
assert type_aliases.History == list[dict[str, Any]]
|
||||
|
||||
|
||||
def test_file_items_alias_resolves_to_list_of_file_item() -> None:
|
||||
hints = get_type_hints(type_aliases)
|
||||
assert hints["FileItems"] == list[dict[str, Any]]
|
||||
assert type_aliases.FileItems == list[dict[str, Any]]
|
||||
|
||||
|
||||
def test_tool_definition_alias_resolves_to_metadata() -> None:
|
||||
assert type_aliases.ToolDefinition == dict[str, Any]
|
||||
|
||||
|
||||
def test_tool_call_alias_resolves_to_metadata() -> None:
|
||||
assert type_aliases.ToolCall == dict[str, Any]
|
||||
|
||||
|
||||
def test_comms_log_callback_alias_resolves_to_callable() -> None:
|
||||
hints = get_type_hints(type_aliases)
|
||||
assert hints["CommsLogCallback"] == Callable[[dict[str, Any]], None]
|
||||
assert type_aliases.CommsLogCallback == Callable[[dict[str, Any]], None]
|
||||
|
||||
|
||||
def test_file_items_diff_named_tuple_has_two_fields() -> None:
|
||||
|
||||
Reference in New Issue
Block a user