@@ -365,43 +365,25 @@ 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 )
399379 assert result ["field1" ] == singer1
400380 assert result ["field2" ] == "POP"
401381 assert result [0 ] == singer1
382+ # unnamed proto fields won't get parsed
402383 assert result [1 ] == singer2 .SerializeToString ()
403384 assert result [2 ] == "POP"
404- assert result [3 ] == "JAZZ"
385+ # unnamed enum fields won't get parsed
386+ assert result [3 ] == 1
405387
406388 def test__array_of_structs (self ):
407389 _type = PBType (
@@ -590,19 +572,21 @@ def test__array_of_structs_with_proto_and_enum(self):
590572 {
591573 "array_field.proto_field" : singer_pb2 .Singer (),
592574 "array_field.enum_field" : singer_pb2 .Genre ,
593- "array_field" : singer_pb2 .Singer (),
575+ "array_field" : singer_pb2 .Singer (), # unused
594576 },
595577 )
596578 assert isinstance (result , list )
597579 assert len (result ) == 2
598580 assert isinstance (result [0 ], Struct )
599581 assert result [0 ]["proto_field" ] == singer1
600582 assert result [0 ]["enum_field" ] == "POP"
601- assert result [0 ][2 ] == singer1
583+ # unnamed proto fields won't get parsed
584+ assert result [0 ][2 ] == singer1 .SerializeToString ()
602585 assert isinstance (result [1 ], Struct )
603586 assert result [1 ]["proto_field" ] == singer2
604587 assert result [1 ]["enum_field" ] == "JAZZ"
605- assert result [1 ][2 ] == singer2
588+ # unnamed proto fields won't get parsed
589+ assert result [1 ][2 ] == singer2 .SerializeToString ()
606590
607591 def test__map (self ):
608592 _type = PBType (
0 commit comments