1212# See the License for the specific language governing permissions and
1313# limitations under the License.
1414
15- # pylint: disable=protected-access
15+ # pylint: disable=protected-access,unsubscriptable-object
1616
1717import json
1818import unittest
4545from opentelemetry .trace import Link , SpanKind
4646from opentelemetry .trace .span import TraceState
4747from opentelemetry .trace .status import Status , StatusCode
48-
4948from tests import (
5049 BASE_TIME ,
5150 PARENT_SPAN_ID ,
@@ -61,6 +60,7 @@ def _get_span(result, rs_idx=0, ss_idx=0, s_idx=0):
6160 return result .resource_spans [rs_idx ].scope_spans [ss_idx ].spans [s_idx ]
6261
6362
63+ # pylint: disable=too-many-public-methods
6464class TestOTLPTraceEncoder (unittest .TestCase ):
6565 def test_encode_single_span (self ):
6666 span = make_span ()
@@ -183,6 +183,7 @@ def test_encode_span_grouping_by_resource(self):
183183 self .assertEqual (len (result .resource_spans ), 2 )
184184
185185 groups = {}
186+ # pylint: disable-next=not-an-iterable
186187 for rs in result .resource_spans :
187188 svc_val = rs .resource .attributes [0 ].value .string_value
188189 span_names = [s .name for ss in rs .scope_spans for s in ss .spans ]
@@ -339,14 +340,14 @@ def test_encode_spans_to_dict(self):
339340 result_dict = result .to_dict ()
340341
341342 self .assertIn ("resourceSpans" , result_dict )
342- s = result_dict ["resourceSpans" ][0 ]["scopeSpans" ][0 ]["spans" ][0 ]
343-
344- self .assertIsInstance (s ["traceId" ], str )
345- self .assertEqual (len (s ["traceId" ]), 32 )
346- self .assertIsInstance (s ["spanId" ], str )
347- self .assertEqual (len (s ["spanId" ]), 16 )
348- self .assertIsInstance (s ["startTimeUnixNano" ], str )
349- self .assertIsInstance (s ["endTimeUnixNano" ], str )
343+ sp = result_dict ["resourceSpans" ][0 ]["scopeSpans" ][0 ]["spans" ][0 ]
344+
345+ self .assertIsInstance (sp ["traceId" ], str )
346+ self .assertEqual (len (sp ["traceId" ]), 32 )
347+ self .assertIsInstance (sp ["spanId" ], str )
348+ self .assertEqual (len (sp ["spanId" ]), 16 )
349+ self .assertIsInstance (sp ["startTimeUnixNano" ], str )
350+ self .assertIsInstance (sp ["endTimeUnixNano" ], str )
350351
351352 def test_encode_spans_json_roundtrip (self ):
352353 parent_ctx = SpanContext (TRACE_ID , PARENT_SPAN_ID , is_remote = True )
0 commit comments