<!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>
3
h                 @   s   d Z yddlZW n ek
r,   ddlZY nX 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rej  dS )
z*Tests for google.protobuf.symbol_database.    N)unittest_pb2)
descriptor)descriptor_pool)symbol_databasec               @   sT   e Zd Zdd Zdd Zdd Zdd Zd	d
 Zdd Zdd Z	dd Z
dd ZdS )SymbolDatabaseTestc             C   s   t jrtjtj d}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 |jtj |S )N)pool)r   Z_USE_C_DESCRIPTORSr   ZSymbolDatabaser   ZDefaultZRegisterFileDescriptorr   
DESCRIPTORZRegisterMessageTestAllTypesNestedMessageOptionalGroupRepeatedGroupZRegisterEnumDescriptorZForeignEnumZ
NestedEnumZRegisterServiceDescriptorZ_TESTSERVICE)selfZdb r   */usr/lib/python3.6/symbol_database_test.py	_Database/   s    zSymbolDatabaseTest._Databasec             C   s&   | j  jtjj}| j|tjk d S )N)r   ZGetPrototyper   r	   r   
assertTrue)r   instancer   r   r   testGetPrototypeA   s    
z#SymbolDatabaseTest.testGetPrototypec             C   s(   | j  jdg}| jtj|d k d S )Nzgoogle/protobuf/unittest.protozprotobuf_unittest.TestAllTypes)r   ZGetMessagesr   r   r	   )r   Zmessagesr   r   r   testGetMessagesF   s
    z"SymbolDatabaseTest.testGetMessagesc             C   sj   | 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 )Nzprotobuf_unittest.TestAllTypesz,protobuf_unittest.TestAllTypes.NestedMessagez,protobuf_unittest.TestAllTypes.OptionalGroupz,protobuf_unittest.TestAllTypes.RepeatedGroup)assertEqualr   r	   r   Z	GetSymbolr
   r   r   )r   r   r   r   testGetSymbolM   s    z SymbolDatabaseTest.testGetSymbolc             C   s8   | j d| j jjdj | j d| j jjdj d S )Nzprotobuf_unittest.ForeignEnumz)protobuf_unittest.TestAllTypes.NestedEnum)r   r   r   ZFindEnumTypeByName	full_name)r   r   r   r   	testEnums[   s    


zSymbolDatabaseTest.testEnumsc             C   s8   | j d| j jjdj | j d| j jjdj d S )Nzprotobuf_unittest.TestAllTypesz,protobuf_unittest.TestAllTypes.NestedMessage)r   r   r   ZFindMessageTypeByNamer   )r   r   r   r   testFindMessageTypeByNamef   s    


z,SymbolDatabaseTest.testFindMessageTypeByNamec             C   s   | j d| j jjdj d S )Nzprotobuf_unittest.TestService)r   r   r   ZFindServiceByNamer   )r   r   r   r   testFindServiceByNamep   s    
z(SymbolDatabaseTest.testFindServiceByNamec             C   s8   | j d| j jjdj | j d| j jjdj d S )Nzgoogle/protobuf/unittest.protoz)protobuf_unittest.TestAllTypes.NestedEnumzprotobuf_unittest.TestAllTypes)r   r   r   ZFindFileContainingSymbolname)r   r   r   r   testFindFileContainingSymbolv   s    


z/SymbolDatabaseTest.testFindFileContainingSymbolc             C   s   | j d| j jjdj d S )Nzgoogle/protobuf/unittest.proto)r   r   r   ZFindFileByNamer   )r   r   r   r   testFindFileByName   s    
z%SymbolDatabaseTest.testFindFileByNameN)__name__
__module____qualname__r   r   r   r   r   r   r   r   r   r   r   r   r   r   -   s   
r   __main__)__doc__Z	unittest2ZunittestImportErrorZgoogle.protobufr   r   r   r   ZTestCaser   r   mainr   r   r   r   <module>    s   [