11"""Tests for LLM bot functionality."""
22
3- import os
43from unittest .mock import Mock , patch
54
65import pytest
@@ -20,31 +19,13 @@ def test_config_creation(self):
2019 assert config .api_key == "sk-balatrollm-proxy-key"
2120 assert config .strategy == "default"
2221
23- def test_config_from_environment (self ):
24- """Test config creation from environment variables."""
25- with patch .dict (
26- os .environ ,
27- {
28- "LITELLM_MODEL" : "env-model" ,
29- "LITELLM_BASE_URL" : "http://env:5000" ,
30- "LITELLM_API_KEY" : "env-key" ,
31- "BALATROLLM_STRATEGY" : "aggressive" ,
32- },
33- ):
34- config = Config .from_environment ()
35- assert config .model == "env-model"
36- assert config .base_url == "http://env:5000"
37- assert config .api_key == "env-key"
38- assert config .strategy == "aggressive"
39-
40- def test_config_from_environment_defaults (self ):
41- """Test config uses defaults when environment variables not set."""
42- with patch .dict (os .environ , {}, clear = True ):
43- config = Config .from_environment ()
44- assert config .model == "cerebras-gpt-oss-120b"
45- assert config .base_url == "http://localhost:4000"
46- assert config .api_key == "sk-balatrollm-proxy-key"
47- assert config .strategy == "default"
22+ def test_config_from_defaults (self ):
23+ """Test config creation with default values."""
24+ config = Config .from_defaults ()
25+ assert config .model == "cerebras/gpt-oss-120b"
26+ assert config .base_url == "http://localhost:4000"
27+ assert config .api_key == "sk-balatrollm-proxy-key"
28+ assert config .strategy == "default"
4829
4930
5031class TestLLMBot :
@@ -89,18 +70,36 @@ def test_run_directory_generation(self, bot):
8970 deck = "Red Deck" ,
9071 stake = 1 ,
9172 seed = "TEST123" ,
92- model = "test- model" ,
73+ model = "test/ model-name " ,
9374 strategy = "default" ,
9475 project_version = "1.0.0" ,
9576 )
9677
9778 assert "v1.0.0" in str (path )
98- assert "test- model" in str (path )
79+ assert "test/ model-name " in str (path ) # Now expects provider/model format
9980 assert "default" in str (path )
10081 assert "RedDeck" in str (path )
10182 assert "s1" in str (path )
10283 assert "TEST123" in str (path )
10384
85+ def test_parse_provider_model (self , bot ):
86+ """Test provider/model parsing for directory structure."""
87+ from balatrollm .data_collection import _parse_provider_model
88+
89+ # Test provider/model format with nested paths
90+ assert _parse_provider_model ("groq/qwen/qwen3-32b" ) == "groq/qwen--qwen3-32b"
91+ assert (
92+ _parse_provider_model ("openrouter/openai/gpt-5" )
93+ == "openrouter/openai--gpt-5"
94+ )
95+ assert _parse_provider_model ("cerebras/gpt-oss-120b" ) == "cerebras/gpt-oss-120b"
96+
97+ # Test simple provider/model format
98+ assert _parse_provider_model ("lmstudio/deepseek-r1" ) == "lmstudio/deepseek-r1"
99+
100+ # Test model without provider (fallback)
101+ assert _parse_provider_model ("gpt4" ) == "gpt4"
102+
104103 def test_get_tools_for_state (self , bot ):
105104 """Test tools selection for different states."""
106105 from balatrobot .enums import State
0 commit comments