� S�Ljc@s�dZdZyddlZWnek r;ddlZnXddlmZddlmZdej fd��YZ e dkr�ej �ndS( s.Test for google.protobuf.internal.wire_format.s#[email protected] (Will Robinson)i����N(tmessage(t wire_formattWireFormatTestcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsod}d}|j|d>|Btj||��tj}|jtj||d�|jtj||d�dS(Ni� iiii����(t assertEqualRtPackTagt assertRaisesRt EncodeError(tselft field_numberttag_typeR((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyt testPackTag/s cCs�xfd D]^}xUtd�D]G}tjtj||��\}}|j||�|j||�qWqW|jttjd�|jttjd�|jttjd�|jttjt��dS( Niiii�iitabcg(iiii�i( trangeRt UnpackTagRRRt TypeErrortNonetobject(Rtexpected_field_numbertexpected_wire_typeRt wire_type((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyt testUnpackTag:s cCs"tj}|jd|d��|jd|d��|jd|d��|jd|d��|jd|d��|jd|d ��|jd |d ��|jd |d ��|jd|d��|jt|d�|jt|d�|jt|d�|jt|t��dS(Niii����iii����il��i���l��i�l����l����l����l����tabcdg(Rt ZigZagEncodeRRRRR(RtZ((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyttestZigZagEncodeHs cCs"tj}|jd|d��|jd|d��|jd|d��|jd|d��|jd|d��|jd|d ��|jd |d ��|jd |d ��|jd|d��|jt|d�|jt|d�|jt|d�|jt|t��dS(Nii����iii����iii���l��i�l��l����l����l����l����Rg(Rt ZigZagDecodeRRRRR(RR((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyttestZigZagDecodeYs c Csfx_d d d d fD]K\}}||}|||�}|j||d|||||f�qWdS( Niiiii�iisFbyte_size_fn: %s, field_number: %d, value: %r Expected: %d, Actual: %d(ii(ii(i�i(ii(R(Rt byte_size_fntvaluetexpected_value_sizeRt tag_bytest expected_sizet actual_size((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pytNumericByteSizeTestHelperjs   c6CsTtjddgtjddgtjddgtjddgtjddgtjddgtjddgtjddgtjddgtjddgtjddgtjtjdgtjddgtjddgtjddgtjtjdgtjddgtjddgtjddgtjd dgtjd dgtjd dgtjd dgtjddgtjddgtjddgtjd dgtjd dgtjd dgtjd dgtj dd gtj tjd gtj ddgtj tjdgtj dd gtj tj d gtj tj d gtjddgtjtjdgtjtjdgtjdd gtjdd gtjdd gtjddgtjddgtjddgtjtdgtjtdgtjddgtjddgtjddgtjtjdgg4}x|D]}|j|�q4WxitjtjfD]U}|jd|dd��|jd|dd��|jd|ddd��q^W|jdtjddjd���dtfd��Y}d}|d|�}|jd|tjd|��|jd |tjd|��|jd|jtjd|��|jd|jtjd|��d|_|jd |jtjd|��d|_|j|jdtj d|��d|_|j|jdtj d|��|j|jdtj d|��|j!t"j#tjdd�dS(Niiii�ii����i ii����i?i����i@iigge��Age���R iii�tasТестsutf-8t MockMessagecBseZd�Zd�ZRS(cSs ||_dS(N(t byte_size(RR$((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyt__init__�scSs|jS(N(R$(R((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pytByteSize�s(t__name__t __module__R%R&(((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyR#�s R$iil ($Rt Int32ByteSizet Int64ByteSizetUInt32ByteSizet UINT32_MAXtUInt64ByteSizet UINT64_MAXtSInt32ByteSizetSInt64ByteSizetFixed32ByteSizetFixed64ByteSizetSFixed32ByteSizet INT32_MINt INT32_MAXtSFixed64ByteSizet INT64_MINt INT64_MAXt FloatByteSizetDoubleByteSizet BoolByteSizetFalsetTruet EnumByteSizeR!tStringByteSizet BytesByteSizeRtdecodeRt GroupByteSizeR$tMessageByteSizetMessageSetItemByteSizeRRR(Rt NUMERIC_ARGStargsRR#tmessage_byte_sizet mock_message((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyttestByteSizeFunctionsts� !      (R'R(R RRRR!RI(((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyR-s     t__main__( t__doc__t __author__t unittest2tunittestt ImportErrortgoogle.protobufRtgoogle.protobuf.internalRtTestCaseRR'tmain(((sM/usr/lib/python2.7/site-packages/google/protobuf/internal/wire_format_test.pyt s �