@@ -410,14 +410,13 @@ def __init__(
410410 self .check_name = check_name
411411
412412 def __eq__ (self , span ):
413- print ("OP" , self .span ["op" ], span .op )
414413 return (
415- (not self .check_trace_id or self .span [ " trace_id" ] == span . trace_id )
416- and (not self .check_op or self .span [ "op" ] == span . op )
417- and (not self .check_status or self .span [ " status" ] == span . status )
418- and (not self .check_origin or self .span [ " origin" ] == span . origin )
414+ (not self .check_trace_id or self .span . trace_id == span [ " trace_id" ] )
415+ and (not self .check_op or self .span . op == span [ "op" ] )
416+ and (not self .check_status or self .span . status == span [ " status" ] )
417+ and (not self .check_origin or self .span . origin == span [ " origin" ] )
419418 and (
420- not self .check_name or self .span [ " description" ] == span . description
419+ not self .check_name or self .span . description == span [ " description" ]
421420 )
422421 )
423422
@@ -430,9 +429,9 @@ def __ne__(self, test_string):
430429@pytest .fixture (name = "SpanTreeEqualUnorderedSiblings" )
431430def unordered_siblings_span_tree_matcher (EmittedSpanMetadataEqual ):
432431 class SpanTreeEqualUnorderedSiblings :
433- def __init__ (self , root_span , span_tree , ** kwargs ):
434- self .root_span = root_span
435- self .span_tree = span_tree
432+ def __init__ (self , expected_root_span , expected_span_tree , ** kwargs ):
433+ self .expected_root_span = expected_root_span
434+ self .expected_span_tree = expected_span_tree
436435
437436 self .span_matcher_kwargs = kwargs
438437
@@ -447,21 +446,21 @@ def _subtree_eq(
447446 self , actual_subtree_root_span , expected_subtree_root_span , by_parent
448447 ):
449448 if actual_subtree_root_span ["span_id" ] not in by_parent :
450- return expected_subtree_root_span == EmittedSpanMetadataEqual (
451- actual_subtree_root_span , ** self .span_matcher_kwargs
449+ return actual_subtree_root_span == EmittedSpanMetadataEqual (
450+ expected_subtree_root_span , ** self .span_matcher_kwargs
452451 )
453452
454453 actual_span_children = by_parent [actual_subtree_root_span ["span_id" ]]
455- expected_span_children = self .span_tree [expected_subtree_root_span ]
454+ expected_span_children = self .expected_span_tree [expected_subtree_root_span ]
456455
457456 if len (actual_span_children ) != len (expected_span_children ):
458457 return False
459458
460459 for expected_child in expected_span_children :
461460 found = False
462461 for actual_child in actual_span_children :
463- if expected_child == EmittedSpanMetadataEqual (
464- actual_child , ** self .span_matcher_kwargs
462+ if actual_child == EmittedSpanMetadataEqual (
463+ expected_child , ** self .span_matcher_kwargs
465464 ):
466465 found = True
467466 if not self ._subtree_eq (
@@ -477,14 +476,16 @@ def _subtree_eq(
477476
478477 def __eq__ (self , event ):
479478 by_parent = self ._construct_parent_to_spans_mapping (event )
480- root_span = event ["contexts" ]["trace" ]
479+ actual_root_span = event ["contexts" ]["trace" ]
481480
482- if self . root_span != EmittedSpanMetadataEqual (
483- root_span , ** self .span_matcher_kwargs
481+ if actual_root_span != EmittedSpanMetadataEqual (
482+ self . expected_root_span , ** self .span_matcher_kwargs
484483 ):
485484 return False
486485
487- return self ._subtree_eq (root_span , self .root_span , by_parent )
486+ return self ._subtree_eq (
487+ actual_root_span , self .expected_root_span , by_parent
488+ )
488489
489490 def __ne__ (self , test_string ):
490491 return not self .__eq__ (test_string )
0 commit comments