@@ -365,34 +365,14 @@ def test__struct_with_proto_and_enum(self):
365365 assert result [2 ] == 0
366366 assert result [3 ] == 1
367367
368- # with proto definition and Singer definition for unnamed nested fields
369- result = _parse_pb_value_to_python_value (
370- value ._pb ,
371- metadata_type ,
372- "struct_field" ,
373- {
374- "struct_field.field1" : singer_pb2 .Singer (),
375- "struct_field.field2" : singer_pb2 .Genre ,
376- "struct_field" : singer_pb2 .Singer (),
377- },
378- )
379- assert isinstance (result , Struct )
380- assert result ["field1" ] == singer1
381- assert result ["field2" ] == "POP"
382- assert result [0 ] == singer1
383- assert result [1 ] == singer2
384- assert result [2 ] == "POP"
385- assert result [3 ] == 1
386-
387- # with proto definition and Genre definition for unnamed nested fields
368+ # with proto definition
388369 result = _parse_pb_value_to_python_value (
389370 value ._pb ,
390371 metadata_type ,
391372 "struct_field" ,
392373 {
393374 "struct_field.field1" : singer_pb2 .Singer (),
394375 "struct_field.field2" : singer_pb2 .Genre ,
395- "struct_field" : singer_pb2 .Genre ,
396376 },
397377 )
398378 assert isinstance (result , Struct )
@@ -401,7 +381,7 @@ def test__struct_with_proto_and_enum(self):
401381 assert result [0 ] == singer1
402382 assert result [1 ] == singer2 .SerializeToString ()
403383 assert result [2 ] == "POP"
404- assert result [3 ] == "JAZZ"
384+ assert result [3 ] == 1
405385
406386 def test__array_of_structs (self ):
407387 _type = PBType (
@@ -590,19 +570,21 @@ def test__array_of_structs_with_proto_and_enum(self):
590570 {
591571 "array_field.proto_field" : singer_pb2 .Singer (),
592572 "array_field.enum_field" : singer_pb2 .Genre ,
593- "array_field" : singer_pb2 .Singer (),
573+ "array_field" : singer_pb2 .Singer (), # unused
594574 },
595575 )
596576 assert isinstance (result , list )
597577 assert len (result ) == 2
598578 assert isinstance (result [0 ], Struct )
599579 assert result [0 ]["proto_field" ] == singer1
600580 assert result [0 ]["enum_field" ] == "POP"
601- assert result [0 ][2 ] == singer1
581+ # unnamed proto fields won't get parsed
582+ assert result [0 ][2 ] == singer1 .SerializeToString ()
602583 assert isinstance (result [1 ], Struct )
603584 assert result [1 ]["proto_field" ] == singer2
604585 assert result [1 ]["enum_field" ] == "JAZZ"
605- assert result [1 ][2 ] == singer2
586+ # unnamed proto fields won't get parsed
587+ assert result [1 ][2 ] == singer2 .SerializeToString ()
606588
607589 def test__map (self ):
608590 _type = PBType (
0 commit comments