@@ -142,44 +142,6 @@ def test_complex_model_name_with_adapter(self):
142142 self .assertEqual (result , "adapter-name" )
143143
144144
145- class TestValidateLoraEnabled (unittest .TestCase ):
146- """Test _validate_lora_enabled method."""
147-
148- def test_validation_passes_when_lora_enabled (self ):
149- """Test validation passes when LoRA is enabled."""
150- tokenizer_manager = MockTokenizerManager (enable_lora = True )
151- serving = ConcreteServingBase (tokenizer_manager )
152-
153- # Should not raise
154- try :
155- serving ._validate_lora_enabled ("sql-expert" )
156- except ValueError :
157- self .fail ("_validate_lora_enabled raised ValueError unexpectedly" )
158-
159- def test_validation_fails_when_lora_disabled (self ):
160- """Test validation fails with helpful message when LoRA is disabled."""
161- tokenizer_manager = MockTokenizerManager (enable_lora = False )
162- serving = ConcreteServingBase (tokenizer_manager )
163-
164- with self .assertRaises (ValueError ) as context :
165- serving ._validate_lora_enabled ("sql-expert" )
166-
167- error_message = str (context .exception )
168- self .assertIn ("sql-expert" , error_message )
169- self .assertIn ("--enable-lora" , error_message )
170- self .assertIn ("not enabled" , error_message )
171-
172- def test_validation_error_mentions_adapter_name (self ):
173- """Test that error message includes the requested adapter name."""
174- tokenizer_manager = MockTokenizerManager (enable_lora = False )
175- serving = ConcreteServingBase (tokenizer_manager )
176-
177- with self .assertRaises (ValueError ) as context :
178- serving ._validate_lora_enabled ("my-custom-adapter" )
179-
180- self .assertIn ("my-custom-adapter" , str (context .exception ))
181-
182-
183145class TestIntegrationScenarios (unittest .TestCase ):
184146 """Integration tests for common usage scenarios."""
185147
@@ -196,9 +158,6 @@ def test_openai_compatible_usage(self):
196158 lora_path = self .serving ._resolve_lora_path (model , explicit_lora )
197159 self .assertEqual (lora_path , "sql-expert" )
198160
199- # Validation should pass
200- self .serving ._validate_lora_enabled (lora_path )
201-
202161 def test_backward_compatible_usage (self ):
203162 """Test backward-compatible usage with explicit lora_path."""
204163 model = "meta-llama/Llama-3.1-8B"
@@ -207,9 +166,6 @@ def test_backward_compatible_usage(self):
207166 lora_path = self .serving ._resolve_lora_path (model , explicit_lora )
208167 self .assertEqual (lora_path , "sql-expert" )
209168
210- # Validation should pass
211- self .serving ._validate_lora_enabled (lora_path )
212-
213169 def test_base_model_usage (self ):
214170 """Test using base model without any adapter."""
215171 model = "meta-llama/Llama-3.1-8B"
@@ -228,10 +184,6 @@ def test_batch_request_scenario(self):
228184 lora_path = self .serving ._resolve_lora_path (model , explicit_lora )
229185 self .assertEqual (lora_path , explicit_lora )
230186
231- # Validate first adapter in list
232- if isinstance (lora_path , list ) and lora_path [0 ]:
233- self .serving ._validate_lora_enabled (lora_path [0 ])
234-
235187 def test_adapter_in_model_overrides_batch_list (self ):
236188 """Test that adapter in model parameter overrides batch list."""
237189 model = "meta-llama/Llama-3.1-8B:preferred-adapter"
@@ -240,24 +192,6 @@ def test_adapter_in_model_overrides_batch_list(self):
240192 lora_path = self .serving ._resolve_lora_path (model , explicit_lora )
241193 self .assertEqual (lora_path , "preferred-adapter" )
242194
243- def test_error_when_lora_not_enabled (self ):
244- """Test comprehensive error flow when LoRA is not enabled."""
245- # Setup server without LoRA enabled
246- tokenizer_manager = MockTokenizerManager (enable_lora = False )
247- serving = ConcreteServingBase (tokenizer_manager )
248-
249- # User tries to use adapter
250- model = "meta-llama/Llama-3.1-8B:sql-expert"
251- lora_path = serving ._resolve_lora_path (model , None )
252-
253- # Should get helpful error
254- with self .assertRaises (ValueError ) as context :
255- serving ._validate_lora_enabled (lora_path )
256-
257- error = str (context .exception )
258- self .assertIn ("--enable-lora" , error )
259- self .assertIn ("sql-expert" , error )
260-
261195
262196class TestEdgeCases (unittest .TestCase ):
263197 """Test edge cases and error conditions."""
@@ -318,14 +252,6 @@ def test_empty_string_as_explicit_lora_path(self):
318252 result = self .serving ._resolve_lora_path ("model-name" , "" )
319253 self .assertEqual (result , "" )
320254
321- def test_validation_with_empty_adapter_name (self ):
322- """Test validation with empty adapter name still raises error."""
323- tokenizer_manager = MockTokenizerManager (enable_lora = False )
324- serving = ConcreteServingBase (tokenizer_manager )
325-
326- with self .assertRaises (ValueError ):
327- serving ._validate_lora_enabled ("" )
328-
329255
330256if __name__ == "__main__" :
331257 unittest .main ()
0 commit comments