U
    4Je7  ć                   @   s   d Z dZddlZ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
 dd	lmZ e
jG d
d dejZedkre ”  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)Śtesting_refleaks)Śdescriptor_databasec                   @   s   e Zd Zdd Zdd ZdS )ŚDescriptorDatabaseTestc              	   C   sx  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 5 Q R X 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ŚassertEqualZFindFileByNameZFindFileContainingSymbolr   ŚassertRaisesRegexŚKeyError)ŚselfŚdbZfile_desc_protoZfile_desc_proto2© r   śU/tmp/pip-unpacked-wheel-0oacnh65/google/protobuf/internal/descriptor_database_test.pyŚtestAdd1   sr    ’’


’
’
’
’
’
’
’
’
’
’
’
’’

’
’zDescriptorDatabaseTest.testAddc              	   C   s“   t  ” }tj tjj”}| |” tj tjj”}d|_	t
jddf}t
 d” | |” |  t|” |  |d jt” |  dt|d j” |  dt|d j” W 5 Q R X d S )NZother_file2T)ŚrecordŚalwaysr   z*Conflict register for file "other_file2": z8already defined in file "google/protobuf/unittest.proto")r   r	   r   r
   r   r   r   r   r   ŚnameŚwarningsŚcatch_warningsŚsimplefilterŚ
assertTrueŚlenZassertIsŚcategoryŚRuntimeWarningZassertInŚstrŚmessage)r   r   Zunittest_fdZconflict_fdŚwr   r   r   ŚtestConflictRegisterj   s(    ’
’

’žz+DescriptorDatabaseTest.testConflictRegisterN)Ś__name__Ś
__module__Ś__qualname__r   r$   r   r   r   r   r   .   s   9r   Ś__main__)Ś__doc__Ś
__author__Zunittestr   Zgoogle.protobufr   r   Zgoogle.protobuf.internalr   r   r   r   ZTestCaser   r%   Śmainr   r   r   r   Ś<module>   s   O