@@ -100,7 +100,9 @@ def test_log_record_no_span_context(self):
100100 log_record = processor .get_log_record (0 )
101101
102102 self .assertIsNotNone (log_record )
103- self .assertEqual (log_record .trace_id , INVALID_SPAN_CONTEXT .trace_id )
103+ self .assertEqual (
104+ log_record .trace_id , INVALID_SPAN_CONTEXT .trace_id
105+ )
104106 self .assertEqual (log_record .span_id , INVALID_SPAN_CONTEXT .span_id )
105107 self .assertEqual (
106108 log_record .trace_flags , INVALID_SPAN_CONTEXT .trace_flags
@@ -119,7 +121,9 @@ def test_log_record_user_attributes(self):
119121 with set_up_test_logging (logging .WARNING ) as (processor , logger ):
120122 # Assert emit gets called for warning message
121123 with self .assertLogs (level = logging .WARNING ):
122- logger .warning ("Warning message" , extra = {"http.status_code" : 200 })
124+ logger .warning (
125+ "Warning message" , extra = {"http.status_code" : 200 }
126+ )
123127
124128 log_record = processor .get_log_record (0 )
125129
@@ -139,8 +143,12 @@ def test_log_record_user_attributes(self):
139143 )
140144 # The line of the log statement is not a constant (changing tests may change that),
141145 # so only check that the attribute is present.
142- self .assertTrue (SpanAttributes .CODE_LINENO in log_record .attributes )
143- self .assertTrue (isinstance (log_record .attributes , BoundedAttributes ))
146+ self .assertTrue (
147+ SpanAttributes .CODE_LINENO in log_record .attributes
148+ )
149+ self .assertTrue (
150+ isinstance (log_record .attributes , BoundedAttributes )
151+ )
144152
145153 def test_log_record_exception (self ):
146154 """Exception information will be included in attributes"""
@@ -185,7 +193,9 @@ def test_log_exc_info_false(self):
185193
186194 self .assertIsNotNone (log_record )
187195 self .assertEqual (log_record .body , "Zero Division Error" )
188- self .assertNotIn (SpanAttributes .EXCEPTION_TYPE , log_record .attributes )
196+ self .assertNotIn (
197+ SpanAttributes .EXCEPTION_TYPE , log_record .attributes
198+ )
189199 self .assertNotIn (
190200 SpanAttributes .EXCEPTION_MESSAGE , log_record .attributes
191201 )
@@ -202,13 +212,19 @@ def test_log_record_trace_correlation(self):
202212
203213 log_record = processor .get_log_record (0 )
204214
205- self .assertEqual (log_record .body , "Critical message within span" )
215+ self .assertEqual (
216+ log_record .body , "Critical message within span"
217+ )
206218 self .assertEqual (log_record .severity_text , "CRITICAL" )
207- self .assertEqual (log_record .severity_number , SeverityNumber .FATAL )
219+ self .assertEqual (
220+ log_record .severity_number , SeverityNumber .FATAL
221+ )
208222 span_context = span .get_span_context ()
209223 self .assertEqual (log_record .trace_id , span_context .trace_id )
210224 self .assertEqual (log_record .span_id , span_context .span_id )
211- self .assertEqual (log_record .trace_flags , span_context .trace_flags )
225+ self .assertEqual (
226+ log_record .trace_flags , span_context .trace_flags
227+ )
212228
213229 def test_log_record_args_are_translated (self ):
214230 with set_up_test_logging (logging .WARNING ) as (processor , logger ):
@@ -229,18 +245,19 @@ def test_default_format_is_called(self):
229245 logger .warning ("Test message" )
230246
231247 log_record = processor .get_log_record (0 )
232- self .assertEqual (
233- log_record .body , "Test message"
234- )
248+ self .assertEqual (log_record .body , "Test message" )
235249
236250 def test_custom_format_is_called (self ):
237- with set_up_test_logging (logging .WARNING , formatter = logging .Formatter ("%(name)s - %(levelname)s - %(message)s" )) as (processor , logger ):
251+ with set_up_test_logging (
252+ logging .WARNING ,
253+ formatter = logging .Formatter (
254+ "%(name)s - %(levelname)s - %(message)s"
255+ ),
256+ ) as (processor , logger ):
238257 logger .warning ("Test message" )
239258
240259 log_record = processor .get_log_record (0 )
241- self .assertEqual (
242- log_record .body , "foo - WARNING - Test message"
243- )
260+ self .assertEqual (log_record .body , "foo - WARNING - Test message" )
244261
245262 def test_log_body_is_always_string (self ):
246263 with set_up_test_logging (logging .WARNING ) as (processor , logger ):
0 commit comments