@@ -292,8 +292,8 @@ def test_simple_log_record_processor_different_msg_types(self):
292292 "Temperature hits high 420 C in Hyderabad" ,
293293 "CRITICAL" ,
294294 ),
295- ([ " list" , "of" , " strings" ] , "WARN" ),
296- ({ " key" : " value" } , "ERROR" ),
295+ ("[' list', 'of', ' strings']" , "WARN" ),
296+ ("{' key': ' value'}" , "ERROR" ),
297297 ]
298298 emitted = [
299299 (item .log_record .body , item .log_record .severity_text )
@@ -307,8 +307,7 @@ def test_simple_log_record_processor_different_msg_types(self):
307307
308308 def test_simple_log_record_processor_custom_single_obj (self ):
309309 """
310- Tests that special-case handling for logging a single non-string object
311- is correctly applied.
310+ Tests that logging a single non-string object uses getMessage
312311 """
313312 exporter = InMemoryLogRecordExporter ()
314313 log_record_processor = BatchLogRecordProcessor (exporter )
@@ -334,9 +333,7 @@ def test_simple_log_record_processor_custom_single_obj(self):
334333 logger .warning ("a string with a percent-s: %s" , "and arg" )
335334 # non-string msg with args - getMessage stringifies msg and formats args into it
336335 logger .warning (["a non-string with a percent-s" , "%s" ], "and arg" )
337- # non-string msg with no args:
338- # - normally getMessage would stringify the object and bypass formatting
339- # - SPECIAL CASE: bypass stringification as well to keep the raw object
336+ # non-string msg with no args - getMessage stringifies the object and bypasses formatting
340337 logger .warning (["a non-string with a percent-s" , "%s" ])
341338 log_record_processor .shutdown ()
342339
@@ -345,7 +342,7 @@ def test_simple_log_record_processor_custom_single_obj(self):
345342 ("a string with a percent-s: %s" ),
346343 ("a string with a percent-s: and arg" ),
347344 ("['a non-string with a percent-s', 'and arg']" ),
348- ([ " a non-string with a percent-s" , "%s" ] ),
345+ ("[' a non-string with a percent-s', '%s']" ),
349346 ]
350347 for emitted , expected in zip (finished_logs , expected ):
351348 self .assertEqual (emitted .log_record .body , expected )
0 commit comments