@@ -80,87 +80,87 @@ def test_load_prompts_with_subdirectory(self):
8080 def test_caching (self ):
8181 """Test that prompts are cached after first load."""
8282 pm = get_prompt_manager ()
83-
83+
8484 # First load
8585 prompts1 = pm .load_prompts ("research" , "research_agent" , "en" )
86-
86+
8787 # Second load should return cached version
8888 prompts2 = pm .load_prompts ("research" , "research_agent" , "en" )
89-
89+
9090 assert prompts1 is prompts2
9191
9292 def test_clear_cache_all (self ):
9393 """Test clearing all cache."""
9494 pm = get_prompt_manager ()
95-
95+
9696 # Load some prompts
9797 pm .load_prompts ("research" , "research_agent" , "en" )
9898 pm .load_prompts ("guide" , "chat_agent" , "en" )
99-
99+
100100 assert len (pm ._cache ) >= 2
101-
101+
102102 pm .clear_cache ()
103103 assert len (pm ._cache ) == 0
104104
105105 def test_clear_cache_module_specific (self ):
106106 """Test clearing cache for specific module."""
107107 pm = get_prompt_manager ()
108-
108+
109109 # Load prompts for multiple modules
110110 pm .load_prompts ("research" , "research_agent" , "en" )
111111 pm .load_prompts ("guide" , "chat_agent" , "en" )
112-
112+
113113 initial_count = len (pm ._cache )
114-
114+
115115 # Clear only research cache
116116 pm .clear_cache ("research" )
117-
117+
118118 # Guide prompts should still be cached
119119 assert any ("guide" in k for k in pm ._cache )
120120 assert not any ("research" in k for k in pm ._cache )
121121
122122 def test_get_prompt_helper (self ):
123123 """Test the get_prompt helper method."""
124124 pm = get_prompt_manager ()
125-
125+
126126 test_prompts = {
127127 "system" : {
128128 "role" : "You are a helpful assistant" ,
129129 "task" : "Answer questions" ,
130130 },
131131 "simple_key" : "Simple value" ,
132132 }
133-
133+
134134 # Test nested access
135135 role = pm .get_prompt (test_prompts , "system" , "role" )
136136 assert role == "You are a helpful assistant"
137-
137+
138138 # Test simple access (no field)
139139 simple = pm .get_prompt (test_prompts , "simple_key" )
140140 assert simple == "Simple value"
141-
141+
142142 # Test fallback
143143 missing = pm .get_prompt (test_prompts , "nonexistent" , "field" , "fallback_value" )
144144 assert missing == "fallback_value"
145145
146146 def test_language_fallback (self ):
147147 """Test language fallback chain."""
148148 pm = get_prompt_manager ()
149-
149+
150150 # Even with a potentially missing language, should fallback
151151 prompts = pm .load_prompts ("research" , "research_agent" , "zh" )
152152 assert isinstance (prompts , dict )
153153
154154 def test_reload_prompts (self ):
155155 """Test force reload bypasses cache."""
156156 pm = get_prompt_manager ()
157-
157+
158158 # Load and cache
159159 prompts1 = pm .load_prompts ("research" , "research_agent" , "en" )
160-
160+
161161 # Force reload
162162 prompts2 = pm .reload_prompts ("research" , "research_agent" , "en" )
163-
163+
164164 # They should be equal but not the same object
165165 assert prompts1 == prompts2
166166 # After reload, cache should have fresh entry
@@ -197,4 +197,3 @@ def test_invalid_language_falls_back(self):
197197
198198if __name__ == "__main__" :
199199 pytest .main ([__file__ , "-v" ])
200-
0 commit comments