This commit is contained in:
Michael D 2025-07-07 12:42:33 +08:00 committed by GitHub
commit 01c0f6beb5
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 16 additions and 1 deletions

View file

@ -1,10 +1,14 @@
"""Type definitions for Claude SDK."""
import sys
from dataclasses import dataclass, field
from pathlib import Path
from typing import Any, Literal, TypedDict
from typing_extensions import NotRequired # For Python < 3.11 compatibility
if sys.version_info >= (3, 11):
from typing import NotRequired
else:
from typing_extensions import NotRequired
# Permission modes
PermissionMode = Literal["default", "acceptEdits", "bypassPermissions"]

View file

@ -1,5 +1,8 @@
"""Tests for Claude SDK type definitions."""
import sys
import importlib
import pytest
from claude_code_sdk import (
AssistantMessage,
ClaudeCodeOptions,
@ -56,6 +59,14 @@ class TestMessageTypes:
assert msg.total_cost_usd == 0.01
assert msg.session_id == "session-123"
def test_import_types_module(self):
"""
Smoke test to ensure claude_code_sdk.types imports without errors
and defines NotRequired.
"""
module = importlib.reload(importlib.import_module("claude_code_sdk.types"))
assert hasattr(module, "NotRequired"), "claude_code_sdk.types should define NotRequired"
class TestOptions:
"""Test Options configuration."""