File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed 
instrumentation-genai/opentelemetry-instrumentation-google-genai/tests/utils Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -206,6 +206,38 @@ def test_flatten_with_mixed_structures():
206206        "foo.pydantic.int_value" : 123 ,
207207    }
208208
209+ def  test_converts_tuple_with_json_fallback ():
210+     input_dict  =  {
211+         "foo" : ("abc" , 123 ),
212+     }
213+     output  =  dict_util .flatten_dict (input_dict )
214+     assert  output  ==  {
215+         "foo.length" : 2 ,
216+         "foo[0]" : "abc" ,
217+         "foo[1]" : 123 ,
218+     }
219+ 
220+ def  test_converts_tuple_with_json_fallback ():
221+     input_dict  =  {
222+         "foo" : ("abc" , 123 ),
223+     }
224+     output  =  dict_util .flatten_dict (input_dict )
225+     assert  output  ==  {
226+         "foo.length" : 2 ,
227+         "foo[0]" : "abc" ,
228+         "foo[1]" : 123 ,
229+     }
230+ 
231+ def  test_json_conversion_handles_unicode ():
232+     input_dict  =  {
233+         "foo" : ("❤️" , 123 ),
234+     }
235+     output  =  dict_util .flatten_dict (input_dict )
236+     assert  output  ==  {
237+         "foo.length" : 2 ,
238+         "foo[0]" : "❤️" ,
239+         "foo[1]" : 123 ,
240+     }
209241
210242def  test_flatten_with_complex_object_not_json_serializable ():
211243    result  =  dict_util .flatten_dict (
    
 
   
 
     
   
   
          
     
  
    
     
 
    
      
     
 
     
    You can’t perform that action at this time.
  
 
    
  
     
    
      
        
     
 
       
      
     
   
 
    
    
  
 
  
 
     
    
0 commit comments