ó
X¾÷Xc           @   s¬   d  Z  y d d l Z Wn e k
 r5 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.symbol_database.iÿÿÿÿN(   t   unittest_pb2(   t
   descriptor(   t   descriptor_pool(   t   symbol_databaset   SymbolDatabaseTestc           B   sP   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 RS(   c         C   s¶   t  j r$ t j d t j ƒ  ƒ } n t j ƒ  } | j t j ƒ | j	 t j
 ƒ | j	 t j
 j ƒ | j	 t j
 j ƒ | j	 t j
 j ƒ | j t j j ƒ | j t j
 j j ƒ | S(   Nt   pool(   R   t   _USE_C_DESCRIPTORSR   t   SymbolDatabaseR   t   Defaultt   RegisterFileDescriptorR    t
   DESCRIPTORt   RegisterMessaget   TestAllTypest   NestedMessaget   OptionalGroupt   RepeatedGroupt   RegisterEnumDescriptort   ForeignEnumt
   NestedEnum(   t   selft   db(    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt	   _Database0   s    	c         C   s5   |  j  ƒ  j t j j ƒ } |  j | t j k ƒ d  S(   N(   R   t   GetPrototypeR    R   R
   t
   assertTrue(   R   t   instance(    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt   testGetPrototypeA   s    c         C   s6   |  j  ƒ  j d g ƒ } |  j t j | d k ƒ d  S(   Ns   google/protobuf/unittest.protos   protobuf_unittest.TestAllTypes(   R   t   GetMessagesR   R    R   (   R   t   messages(    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt   testGetMessagesF   s
    c         C   s•   |  j  t j |  j ƒ  j d ƒ ƒ |  j  t j j |  j ƒ  j d ƒ ƒ |  j  t j j |  j ƒ  j d ƒ ƒ |  j  t j j |  j ƒ  j d ƒ ƒ d  S(   Ns   protobuf_unittest.TestAllTypess,   protobuf_unittest.TestAllTypes.NestedMessages,   protobuf_unittest.TestAllTypes.OptionalGroups,   protobuf_unittest.TestAllTypes.RepeatedGroup(   t   assertEqualR    R   R   t	   GetSymbolR   R   R   (   R   (    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt   testGetSymbolM   s    


c         C   sN   |  j  d |  j ƒ  j j d ƒ j ƒ |  j  d |  j ƒ  j j d ƒ j ƒ d  S(   Ns   protobuf_unittest.ForeignEnums)   protobuf_unittest.TestAllTypes.NestedEnum(   R   R   R   t   FindEnumTypeByNamet	   full_name(   R   (    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt	   testEnums[   s    c         C   sN   |  j  d |  j ƒ  j j d ƒ j ƒ |  j  d |  j ƒ  j j d ƒ j ƒ d  S(   Ns   protobuf_unittest.TestAllTypess,   protobuf_unittest.TestAllTypes.NestedMessage(   R   R   R   t   FindMessageTypeByNameR!   (   R   (    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt   testFindMessageTypeByNamef   s    c         C   sN   |  j  d |  j ƒ  j j d ƒ j ƒ |  j  d |  j ƒ  j j d ƒ j ƒ d  S(   Ns   google/protobuf/unittest.protos)   protobuf_unittest.TestAllTypes.NestedEnums   protobuf_unittest.TestAllTypes(   R   R   R   t   FindFileContainingSymbolt   name(   R   (    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt   testFindFindContainingSymbolp   s    c         C   s)   |  j  d |  j ƒ  j j d ƒ j ƒ d  S(   Ns   google/protobuf/unittest.proto(   R   R   R   t   FindFileByNameR&   (   R   (    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt   testFindFileByName{   s    (
   t   __name__t
   __module__R   R   R   R   R"   R$   R'   R)   (    (    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyR   .   s   						
	t   __main__(   t   __doc__t	   unittest2t   unittestt   ImportErrort   google.protobufR    R   R   R   t   TestCaseR   R*   t   main(    (    (    sO   /tmp/pip-build-h1VYrz/protobuf/google/protobuf/internal/symbol_database_test.pyt   <module>!   s   T