o
    ‹¨Êh@  ã                   @   sž   d Z dZzddlZW n ey   ddlZY nw ddl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 G d	d
„ d
ejƒZedkrMe ¡  dS dS )z.Tests for google.protobuf.descriptor_database.z"matthewtoia@google.com (Matt Toia)é    N)Úunittest_pb2)Údescriptor_pb2)Úfactory_test2_pb2)Úno_package_pb2)Údescriptor_databasec                   @   s   e Zd Zdd„ Zdd„ ZdS )ÚDescriptorDatabaseTestc                 C   sŽ  t  ¡ }tj tjj¡}tj tjj¡}| 	|¡ | 	|¡ |  
|| d¡¡ |  
|| d¡¡ |  
|| d¡¡ |  
|| d¡¡ |  
|| d¡¡ |  
|| d¡¡ |  
|| d¡¡ |  
|| d¡¡ |  
|| d	¡¡ |  
|| d
¡¡ |  
|| d¡¡ |  
|| d¡¡ tj tjj¡}| 	|¡ |  
|| d¡¡ |  
|| d¡¡ |  td¡� | d¡ W d   ƒ d S 1 sÀw   Y  d S )Nz,google/protobuf/internal/factory_test2.protoz/google.protobuf.python.internal.Factory2MessagezEgoogle.protobuf.python.internal.Factory2Message.NestedFactory2Messagez,google.protobuf.python.internal.Factory2EnumzBgoogle.protobuf.python.internal.Factory2Message.NestedFactory2EnumzDgoogle.protobuf.python.internal.MessageWithNestedEnumOnly.NestedEnumz:google.protobuf.python.internal.Factory2Message.list_fieldz>google.protobuf.python.internal.Factory2Enum.FACTORY_2_VALUE_0z1google.protobuf.python.internal.FACTORY_2_VALUE_0z.NO_PACKAGE_VALUE_0z-google.protobuf.python.internal.another_fieldz>google.protobuf.python.internal.Factory2Message.one_more_fieldzprotobuf_unittest.TestServicez)protobuf_unittest.TestAllTypes.none_fieldz"\'protobuf_unittest\.NoneMessage\'zprotobuf_unittest.NoneMessage)r   ÚDescriptorDatabaser   ÚFileDescriptorProtoÚ
FromStringr   Ú
DESCRIPTORÚserialized_pbr   ÚAddÚassertEqualÚFindFileByNameÚFindFileContainingSymbolr   ÚassertRaisesRegexpÚKeyError)ÚselfÚdbÚfile_desc_protoÚfile_desc_proto2© r   úc/var/www/html/env/lib/python3.10/site-packages/google/protobuf/internal/descriptor_database_test.pyÚtestAdd4   st   ÿÿ


ÿ
ÿ
ÿ
ÿ
ÿ
ÿ
ÿ
ÿ
ÿ
ÿ
ÿ
ÿÿ

ÿ
ÿ"ÿzDescriptorDatabaseTest.testAddc                 C   sÊ   t  ¡ }tj tjj¡}| |¡ tj tjj¡}d|_	t
jdd��9}t
 d¡ | |¡ |  t|ƒ¡ |  |d jt¡ |  dt|d jƒ¡ |  dt|d jƒ¡ W d   ƒ d S 1 s^w   Y  d S )NÚ
other_fileT)ÚrecordÚalwaysr   z)Conflict register for file "other_file": z8already defined in file "google/protobuf/unittest.proto")r   r   r   r	   r
   r   r   r   r   ÚnameÚwarningsÚcatch_warningsÚsimplefilterÚ
assertTrueÚlenÚassertIsÚcategoryÚRuntimeWarningÚassertInÚstrÚmessage)r   r   Úunittest_fdÚconflict_fdÚwr   r   r   ÚtestConflictRegisterm   s*   ÿ
ÿ

ÿþ"øz+DescriptorDatabaseTest.testConflictRegisterN)Ú__name__Ú
__module__Ú__qualname__r   r,   r   r   r   r   r   2   s    9r   Ú__main__)Ú__doc__Ú
__author__Ú	unittest2ÚunittestÚImportErrorr   Úgoogle.protobufr   r   Úgoogle.protobuf.internalr   r   r   ÚTestCaser   r-   Úmainr   r   r   r   Ú<module>   s"    ÿPÿ