@@ -523,6 +523,10 @@ def test__array_of_structs_with_proto_and_enum(self):
523523 "field_name" : "enum_field" ,
524524 "type_" : enum_type (),
525525 },
526+ {
527+ "field_name" : None ,
528+ "type_" : proto_type (),
529+ },
526530 ]
527531 }
528532 }
@@ -538,6 +542,7 @@ def test__array_of_structs_with_proto_and_enum(self):
538542 "values" : [
539543 {"bytes_value" : singer1 .SerializeToString ()},
540544 {"int_value" : 0 }, # POP
545+ {"bytes_value" : singer1 .SerializeToString ()},
541546 ]
542547 }
543548 },
@@ -546,6 +551,7 @@ def test__array_of_structs_with_proto_and_enum(self):
546551 "values" : [
547552 {"bytes_value" : singer2 .SerializeToString ()},
548553 {"int_value" : 1 }, # JAZZ
554+ {"bytes_value" : singer2 .SerializeToString ()},
549555 ]
550556 }
551557 },
@@ -559,6 +565,7 @@ def test__array_of_structs_with_proto_and_enum(self):
559565 assert type (metadata_type .element_type ) is SqlType .Struct
560566 assert type (metadata_type .element_type ["proto_field" ]) is SqlType .Proto
561567 assert type (metadata_type .element_type ["enum_field" ]) is SqlType .Enum
568+ assert type (metadata_type .element_type [2 ]) is SqlType .Proto
562569
563570 # without proto definition
564571 result = _parse_pb_value_to_python_value (
@@ -569,9 +576,11 @@ def test__array_of_structs_with_proto_and_enum(self):
569576 assert isinstance (result [0 ], Struct )
570577 assert result [0 ]["proto_field" ] == singer1 .SerializeToString ()
571578 assert result [0 ]["enum_field" ] == 0
579+ assert result [0 ][2 ] == singer1 .SerializeToString ()
572580 assert isinstance (result [1 ], Struct )
573581 assert result [1 ]["proto_field" ] == singer2 .SerializeToString ()
574582 assert result [1 ]["enum_field" ] == 1
583+ assert result [1 ][2 ] == singer2 .SerializeToString ()
575584
576585 # with proto definition
577586 result = _parse_pb_value_to_python_value (
@@ -581,16 +590,19 @@ def test__array_of_structs_with_proto_and_enum(self):
581590 {
582591 "array_field.proto_field" : singer_pb2 .Singer (),
583592 "array_field.enum_field" : singer_pb2 .Genre ,
593+ "array_field" : singer_pb2 .Singer (),
584594 },
585595 )
586596 assert isinstance (result , list )
587597 assert len (result ) == 2
588598 assert isinstance (result [0 ], Struct )
589599 assert result [0 ]["proto_field" ] == singer1
590600 assert result [0 ]["enum_field" ] == "POP"
601+ assert result [0 ][2 ] == singer1
591602 assert isinstance (result [1 ], Struct )
592603 assert result [1 ]["proto_field" ] == singer2
593604 assert result [1 ]["enum_field" ] == "JAZZ"
605+ assert result [1 ][2 ] == singer2
594606
595607 def test__map (self ):
596608 _type = PBType (
0 commit comments