@@ -143,19 +143,22 @@ def test_empty_string_value_returns_empty(self):
143143 def test_strict_mode_with_primitive_types (self ):
144144 """Test that strict mode works properly with primitive types."""
145145 mock_context = Mock (spec = ReadonlyContext )
146-
146+
147147 # Test with string
148148 mock_context .state = {"token" : "my-token" }
149149 provider = create_session_state_header_provider (
150150 state_key = "token" , strict = True
151151 )
152152 headers = provider (mock_context )
153153 assert headers == {"Authorization" : "Bearer my-token" }
154-
154+
155155 # Test with int
156156 mock_context .state = {"count" : 42 }
157157 provider = create_session_state_header_provider (
158- state_key = "count" , header_name = "X-Count" , header_format = "{value}" , strict = True
158+ state_key = "count" ,
159+ header_name = "X-Count" ,
160+ header_format = "{value}" ,
161+ strict = True ,
159162 )
160163 headers = provider (mock_context )
161164 assert headers == {"X-Count" : "42" }
@@ -171,13 +174,12 @@ def test_strict_mode_raises_on_non_primitive_types(self):
171174
172175 with pytest .raises (ValueError ) as exc_info :
173176 provider (mock_context )
174-
177+
175178 assert "complex_data" in str (exc_info .value )
176179 assert "dict" in str (exc_info .value )
177180 assert "may not serialize correctly" in str (exc_info .value )
178181
179182
180-
181183class TestMcpToolsetConfigStateHeaderMapping :
182184 """Test suite for state_header_mapping configuration."""
183185
@@ -341,4 +343,3 @@ def test_from_config_with_strict_mode(self):
341343
342344 assert "data" in str (exc_info .value )
343345 assert "dict" in str (exc_info .value )
344-
0 commit comments