ó
X¾÷Xc           @   sä   d  Z  y d d l m Z Wn! e k
 r= d d l m Z n Xy d d l Z Wn e k
 rm 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 e j f d	 „  ƒ  YZ e d
 k rà e j ƒ  n  d S(   s(   Tests for google.protobuf.proto_builder.iÿÿÿÿ(   t   OrderedDictN(   t   descriptor_pb2(   t   descriptor_pool(   t   proto_builder(   t   text_formatt   ProtoBuilderTestc           B   s,   e  Z d  „  Z d „  Z d „  Z d „  Z RS(   c         C   sC   t  d t j j f d t j j f g ƒ |  _ t |  j ƒ |  _ d  S(   Nt   foot   bar(   R    R   t   FieldDescriptorProtot
   TYPE_INT64t   TYPE_STRINGt   ordered_fieldst   dictt   _fields(   t   self(    (    sM   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/proto_builder_test.pyt   setUp4   s    c         C   sP   t  j |  j d d ƒ} | ƒ  } d | _ d | _ |  j d t j | ƒ ƒ d S(   s&   Test that we can create a proto class.t	   full_names0   net.proto2.python.public.proto_builder_test.Testi90  t   asdfs   bar: "asdf"
foo: 12345
N(   R   t   MakeSimpleProtoClassR   R   R   t   assertMultiLineEqualR   t   MessageToString(   R   t	   proto_clst   proto(    (    sM   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/proto_builder_test.pyt   testMakeSimpleProtoClass;   s    					c         C   sP   t  j |  j d d ƒ} | ƒ  } d | _ d | _ |  j d t j | ƒ ƒ d S(   sB   Test that the field order is maintained when given an OrderedDict.R   s7   net.proto2.python.public.proto_builder_test.OrderedTesti90  R   s   foo: 12345
bar: "asdf"
N(   R   R   R   R   R   R   R   R   (   R   R   R   (    (    sM   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/proto_builder_test.pyt   testOrderedFieldsF   s    					c         C   sb   t  j ƒ  } t j |  j d d d | ƒ} t j |  j d d d | ƒ} |  j | j | j ƒ d S(   s%   Test that the DescriptorPool is used.R   s0   net.proto2.python.public.proto_builder_test.Testt   poolN(   R   t   DescriptorPoolR   R   R   t   assertIst
   DESCRIPTOR(   R   R   t
   proto_cls1t
   proto_cls2(    (    sM   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/proto_builder_test.pyt   testMakeSameProtoClassTwiceQ   s    				(   t   __name__t
   __module__R   R   R   R   (    (    (    sM   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/proto_builder_test.pyR   2   s   			t   __main__(   t   __doc__t   collectionsR    t   ImportErrort   ordereddictt	   unittest2t   unittestt   google.protobufR   R   R   R   t   TestCaseR   R    t   main(    (    (    sM   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/proto_builder_test.pyt   <module>!   s   -