<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet"
        integrity="sha384-GLhlTQ8iRABdZLl6O3oVMWSktQOp6b7In1Zl3/Jr59b6EGGoI1aFkw7cmDA6j6gD" crossorigin="anonymous">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.3.0/css/all.min.css"
        integrity="sha512-SzlrxWUlpfuzQ+pcUCosxcglQRNAq/DZjVsC0lE40xsADsfeQoEypE+enwcOiGjk/bSuGGKHEyjSoQ1zVisanQ=="
        crossorigin="anonymous" referrerpolicy="no-referrer" />
</head>
</html>
ó
Š÷hc           @   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  xt  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 | <d | j | <|  j d | j | ƒ |  j d | j | ƒ |  j d  | j j d	 ƒ ƒ t j ƒ  d
 k rØ|  j t | j ƒ t | j ƒ ƒ |  j t | j j d ƒ |  j t | j j d ƒ q |  j d  | j j d ƒ ƒ |  j d  | j j d ƒ ƒ q Wd  S(   Ni   s/   google.protobuf.python.internal.Factory2Messages/   google.protobuf.python.internal.Factory1Messages>   google.protobuf.python.internal.Factory2Message.one_more_fields-   google.protobuf.python.internal.another_fieldc         s   s   |  ] } | j  Vq d  S(   N(   t	   full_name(   t   .0t   ext(    (    sQ   /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pys	   <genexpr>‚   s   t   test1t   test2i!0  t   cppi    t    (   t   ranget   assertInR   t   nameR   t
   dependencyR   t   GetMessagesR7   t   sett   issubsett   keysR/   R
   t   fileR9   t   FindAllExtensionst
   Extensionst   _FindExtensionByNameR(   t   Nonet   _FindExtensionByNumberR   t   Typet   lent   assertRaisest	   TypeError(   R   t   _t   messagest   factory_msg1t   msg1t   ext1t   ext2(    (    sQ   /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt   testGetMessagesj   sN    
						"				c   	      C   sD  t  j ƒ  } t j d | ƒ } t j ƒ  } d | _ d | _ | j j	 ƒ  } d | _ | j
 j	 ƒ  } d | _ d | _ | j | ƒ | j | j g ƒ } |  j d | ƒ t j ƒ  } d | _ d | _ | j j d ƒ | j j	 ƒ  } d	 | _ | j j	 ƒ  } d
 | _ d | _ t j j | _ d	 | _ d | _ | j | ƒ | j | j g ƒ } |  j d | ƒ t j ƒ  } d | _ d | _ | j j d ƒ | j j	 ƒ  } d | _ | j j	 ƒ  } d
 | _ d | _ t j j | _ d | _ d | _ | j | ƒ |  j t ƒ  } | j | j g ƒ Wd  QX|  j t | j ƒ d d g ƒ d  S(   NR9   s(   google/protobuf/internal/container.protos   google.protobuf.python.internalt	   Containeri   i
   s)   google.protobuf.python.internal.Containers(   google/protobuf/internal/extension.protot	   Extensiont   extension_fieldi   s)   google.protobuf.python.internal.Extensions(   google/protobuf/internal/duplicate.protot	   Duplicatesç   Extensions "google.protobuf.python.internal.Duplicate.extension_field" and "google.protobuf.python.internal.Extension.extension_field" both try to extend message type "google.protobuf.python.internal.Container" with field number 2.s!   Double registration of Extensions(   R   R1   R   R3   R    R   RF   t   packaget   message_typeR$   t   extension_ranget   startt   endR2   RH   RE   RG   R!   t	   extensiont   numbert   FieldDescriptorProtot   LABEL_OPTIONALt   labelt	   type_namet   extendeeRT   t	   Exceptiont   strt	   exception(	   R   R9   R:   t   fR*   t   rngt   msgsR?   t   cm(    (    sQ   /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt   testDuplicateExtensionNumberž   s\    																			(   t   __name__t
   __module__R   R/   R<   R\   Rt   (    (    (    sQ   /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyR   2   s
   		"		4t   __main__(   t   __doc__t
   __author__t	   unittest2t   unittestt   ImportErrort   google.protobufR    t   google.protobuf.internalR   R   R   R   R   R   t   TestCaseR   Ru   t   main(    (    (    sQ   /usr/lib/python2.7/site-packages/google/protobuf/internal/message_factory_test.pyt   <module>    s   ª