@@ -489,6 +489,7 @@ def test_text_generation(
489
489
span = None
490
490
for sp in transaction ["spans" ]:
491
491
if sp ["op" ] == "gen_ai.generate_text" :
492
+ assert span is None , "there is exactly one gen_ai span"
492
493
span = sp
493
494
else :
494
495
# there should be no other spans, just the gen_ai span
@@ -558,6 +559,7 @@ def test_text_generation_streaming(
558
559
span = None
559
560
for sp in transaction ["spans" ]:
560
561
if sp ["op" ] == "gen_ai.generate_text" :
562
+ assert span is None , "there is exactly one gen_ai span"
561
563
span = sp
562
564
else :
563
565
# there should be no other spans, just the gen_ai span
@@ -625,6 +627,7 @@ def test_chat_completion(
625
627
span = None
626
628
for sp in transaction ["spans" ]:
627
629
if sp ["op" ] == "gen_ai.chat" :
630
+ assert span is None , "there is exactly one gen_ai span"
628
631
span = sp
629
632
else :
630
633
# there should be no other spans, just the gen_ai span
@@ -698,6 +701,7 @@ def test_chat_completion_streaming(
698
701
span = None
699
702
for sp in transaction ["spans" ]:
700
703
if sp ["op" ] == "gen_ai.chat" :
704
+ assert span is None , "there is exactly one gen_ai span"
701
705
span = sp
702
706
else :
703
707
# there should be no other spans, just the gen_ai span
@@ -765,6 +769,7 @@ def test_chat_completion_api_error(
765
769
span = None
766
770
for sp in transaction ["spans" ]:
767
771
if sp ["op" ] == "gen_ai.chat" :
772
+ assert span is None , "there is exactly one gen_ai span"
768
773
span = sp
769
774
else :
770
775
# there should be no other spans, just the gen_ai span
@@ -858,6 +863,7 @@ def test_chat_completion_with_tools(
858
863
span = None
859
864
for sp in transaction ["spans" ]:
860
865
if sp ["op" ] == "gen_ai.chat" :
866
+ assert span is None , "there is exactly one gen_ai span"
861
867
span = sp
862
868
else :
863
869
# there should be no other spans, just the gen_ai span
@@ -949,6 +955,7 @@ def test_chat_completion_streaming_with_tools(
949
955
span = None
950
956
for sp in transaction ["spans" ]:
951
957
if sp ["op" ] == "gen_ai.chat" :
958
+ assert span is None , "there is exactly one gen_ai span"
952
959
span = sp
953
960
else :
954
961
# there should be no other spans, just the gen_ai span
0 commit comments