File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -191,17 +191,20 @@ def test_handle_with_invalid_utf8_data(self):
191191 _fixture_port_num = self ._always_generate_random_port_WHEN_called ()
192192 self .assertIsNotNone (_fixture_port_num )
193193 self .assertIsInstance (_fixture_port_num , int )
194+ _fixture_client_addr = ("224.0.0.1" , _fixture_port_num )
194195 data = b'\xff \xfe \xfd \xfc ' # Invalid UTF-8 bytes
195196 sock = multicast .genSocket ()
196197 handler = multicast .hear .HearUDPHandler (
197198 request = (data , sock ),
198- client_address = ( "224.0.0.1" , _fixture_port_num ) ,
199+ client_address = _fixture_client_addr ,
199200 server = None
200201 )
201202 try :
202203 # Should silently ignore invalid UTF-8 data
203- handler .handle ()
204- # If no exception is raised, the test passes
204+ handler .handle () # If no exception is raised, the test passes
205+ # Verify handler state after processing invalid data
206+ self .assertIsNone (handler .server ) # Server should remain None
207+ self .assertEqual (handler .client_address , _fixture_client_addr )
205208 except Exception as e :
206209 self .fail (f"Handler raised an unexpected exception: { e } " )
207210 finally :
You can’t perform that action at this time.
0 commit comments