@@ -88,6 +88,48 @@ def test_split_mixed_script_text(self):
8888 self .assertEqual (segments [0 ], ("नमस्ते भाई" , "devanagari" ))
8989
9090
91+ class TestLLMModuleImport (unittest .TestCase ):
92+ """Test LLM module import and basic functionality without API keys."""
93+
94+ def test_llm_module_import (self ):
95+ """Test that LLM modules can be imported without API keys."""
96+ # Clear all API keys to simulate no-key environment
97+ api_keys = [
98+ "OPENAI_API_KEY" ,
99+ "ANTHROPIC_API_KEY" ,
100+ "GOOGLE_API_KEY" ,
101+ "GEMINI_API_KEY" ,
102+ "COHERE_API_KEY" ,
103+ "INDICATE_LLM_PROVIDER" ,
104+ "INDICATE_LLM_MODEL"
105+ ]
106+ original_values = {}
107+ for key in api_keys :
108+ if key in os .environ :
109+ original_values [key ] = os .environ [key ]
110+ del os .environ [key ]
111+
112+ try :
113+ # These imports should work without API keys
114+ from indicate .llm_indic import IndicLLMTransliterator
115+ from indicate .indic_utils import detect_language_from_script
116+ from indicate .cli import cli
117+
118+ # Basic functionality that doesn't require API calls should work
119+ detected = detect_language_from_script ("नमस्ते" )
120+ self .assertEqual (detected , "hindi" )
121+
122+ # LLM class initialization should fail gracefully with clear error
123+ with self .assertRaises (ValueError ) as context :
124+ IndicLLMTransliterator ("hindi" , "english" )
125+ self .assertIn ("No LLM provider detected" , str (context .exception ))
126+
127+ finally :
128+ # Restore original environment
129+ for key , value in original_values .items ():
130+ os .environ [key ] = value
131+
132+
91133class TestIndicLLMTransliterator (unittest .TestCase ):
92134 """Test IndicLLMTransliterator class."""
93135
0 commit comments