ó
SÉLjc @ sâ d Z d Z y d d l Z Wn e k
r; d d l Z n Xd d l m Z d d l m Z d d l m Z d d l m
Z
d d l m Z d d l m Z d d
l m
Z
d e j f d „ ƒ YZ e d
k rÞ e j ƒ n d S( s* Tests for google.protobuf.message_factory.s" matthewtoia@google.com (Matt Toia)iÿÿÿÿN( t descriptor_pb2( t api_implementation( t factory_test1_pb2( t factory_test2_pb2( t descriptor_database( t descriptor_pool( t message_factoryt MessageFactoryTestc B s5 e Z d „ Z d „ Z d „ Z d „ Z d „ Z RS( c C s: t j j t j j ƒ | _ t j j t j j ƒ | _ d S( N( R t FileDescriptorProtot
FromStringR t
DESCRIPTORt
serialized_pbt factory_test1_fdR t factory_test2_fd( t self( ( sQ /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt setUp4 s c C sÇ | ƒ } d | _ d | _ d | j _ d | j _ d | j _ d | j j _ d | j _ | j j j
d d d g ƒ | j j j d ƒ d | _ d | _ d | j _ d | j _ d
| j j _ d | j _ d | _ | j j
d d d g ƒ | j j d ƒ | j
j ƒ d
| j
d _ d | j
d _ | j
j d d d d ƒ d
| j j _ d | j j j j _ | j ƒ } t j j | ƒ } | j ƒ } | j | | ƒ | j | ƒ } | j | | ƒ d S( Ni* i s nested message valuei i u oneu twou threeu fouri s one deeps zero deept hellot worldt part_1t testingt part_2t 123i ( t mandatoryt nested_factory_2_enumt nested_factory_2_messaget valuet factory_1_messaget factory_1_enumt nested_factory_1_enumt nested_factory_1_messaget scalar_valuet
list_valuet extendt appendt circular_messaget groupedt addR R t loopt SerializeToStringR t Factory2MessageR t assertEqual( R t clst msgt
serializedt convertedt reserializedt result( ( sQ /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt _ExerciseDynamicClass: s>
c C s± t j ƒ } t j | ƒ } | j | j ƒ | j | j ƒ t j ƒ } | j | j
d ƒ ƒ } | j | t j
k ƒ | j | ƒ | j | j
d ƒ ƒ } | j | | k ƒ d S( Ns/ google.protobuf.python.internal.Factory2Message( R t DescriptorDatabaseR t DescriptorPoolt AddR R
R t MessageFactoryt GetPrototypet FindMessageTypeByNamet assertFalseR R' R/ t
assertTrue( R t dbt poolt factoryR) t cls2( ( sQ /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt testGetPrototype\ s
c C s xt d ƒ D]} | j | j j | j j ƒ t j | j | j g ƒ } | j t d d g ƒ j
t | j ƒ ƒ ƒ ƒ | j | d ƒ | d } | j t d d g ƒ j
t d „ | j
j j j | j
ƒ Dƒ ƒ ƒ ƒ | d ƒ } | j j d ƒ } | j j d ƒ } d | j |