Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/claude_code_sdk/types.py
Original file line number Diff line number Diff line change
@@ -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"]
Expand Down
11 changes: 11 additions & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
"""Tests for Claude SDK type definitions."""

import sys
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You don't need to import sys and pytest

import importlib
import pytest
from claude_code_sdk import (
AssistantMessage,
ClaudeCodeOptions,
Expand Down Expand Up @@ -56,6 +59,14 @@ def test_result_message(self):
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."""
Expand Down
Loading