3 SÉLjûã @s„dZy ddlZWnek r,ddlZYnXddlmZddlmZddlmZddlmZGdd„dej ƒZ e d kr€ej ƒdS) z*Tests for google.protobuf.symbol_database.éN)Ú unittest_pb2)Ú descriptor)Údescriptor_pool)Úsymbol_databasec@sTeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dd„Z dS)ÚSymbolDatabaseTestcCs�tjrtjtjƒd�}ntjƒ}|jtjƒ|j tj ƒ|j tj j ƒ|j tj j ƒ|j tj j ƒ|jtjjƒ|jtj jjƒ|jtjƒ|S)N)Úpool)rZ_USE_C_DESCRIPTORSrZSymbolDatabaserZDefaultZRegisterFileDescriptorrÚ DESCRIPTORZRegisterMessageÚ TestAllTypesÚ NestedMessageÚ OptionalGroupÚ RepeatedGroupZRegisterEnumDescriptorZ ForeignEnumZ NestedEnumZRegisterServiceDescriptorZ _TESTSERVICE)ÚselfZdb©rú*/usr/lib/python3.6/symbol_database_test.pyÚ _Database/s   zSymbolDatabaseTest._DatabasecCs&|jƒjtjjƒ}|j|tjkƒdS)N)rZ GetPrototyperr rÚ assertTrue)r ÚinstancerrrÚtestGetPrototypeAs z#SymbolDatabaseTest.testGetPrototypecCs(|jƒjdgƒ}|jtj|dkƒdS)Nzgoogle/protobuf/unittest.protozprotobuf_unittest.TestAllTypes)rZ GetMessagesrrr )r ZmessagesrrrÚtestGetMessagesFs z"SymbolDatabaseTest.testGetMessagescCsj|jtj|jƒjdƒƒ|jtjj|jƒjdƒƒ|jtjj|jƒjdƒƒ|jtjj|jƒjdƒƒdS)Nzprotobuf_unittest.TestAllTypesz,protobuf_unittest.TestAllTypes.NestedMessagez,protobuf_unittest.TestAllTypes.OptionalGroupz,protobuf_unittest.TestAllTypes.RepeatedGroup)Ú assertEqualrr rZ GetSymbolr r r )r rrrÚ testGetSymbolMs z SymbolDatabaseTest.testGetSymbolcCs8|jd|jƒjjdƒjƒ|jd|jƒjjdƒjƒdS)Nzprotobuf_unittest.ForeignEnumz)protobuf_unittest.TestAllTypes.NestedEnum)rrrZFindEnumTypeByNameÚ full_name)r rrrÚ testEnums[s   zSymbolDatabaseTest.testEnumscCs8|jd|jƒjjdƒjƒ|jd|jƒjjdƒjƒdS)Nzprotobuf_unittest.TestAllTypesz,protobuf_unittest.TestAllTypes.NestedMessage)rrrZFindMessageTypeByNamer)r rrrÚtestFindMessageTypeByNamefs   z,SymbolDatabaseTest.testFindMessageTypeByNamecCs|jd|jƒjjdƒjƒdS)Nzprotobuf_unittest.TestService)rrrZFindServiceByNamer)r rrrÚtestFindServiceByNameps z(SymbolDatabaseTest.testFindServiceByNamecCs8|jd|jƒjjdƒjƒ|jd|jƒjjdƒjƒdS)Nzgoogle/protobuf/unittest.protoz)protobuf_unittest.TestAllTypes.NestedEnumzprotobuf_unittest.TestAllTypes)rrrZFindFileContainingSymbolÚname)r rrrÚtestFindFileContainingSymbolvs   z/SymbolDatabaseTest.testFindFileContainingSymbolcCs|jd|jƒjjdƒjƒdS)Nzgoogle/protobuf/unittest.proto)rrrZFindFileByNamer)r rrrÚtestFindFileByName�s z%SymbolDatabaseTest.testFindFileByNameN) Ú__name__Ú __module__Ú __qualname__rrrrrrrrrrrrrr-s   rÚ__main__) Ú__doc__Z unittest2ZunittestÚ ImportErrorZgoogle.protobufrrrrZTestCaserrÚmainrrrrÚ s     [