ó Du—ac@sûdZdZddlZddlZddlZddlmZddlmZye Wne k rqe Z nXd„Z d„Z d„Zd „Zd „Zd „Zd „Zd „Zd„Zd„Zd„Zd„Zdejfd„ƒYZdS(spUtilities for Python proto2 tests. This is intentionally modeled on C++ code in //google/protobuf/test_util.*. s#robinson@google.com (Will Robinson)iÿÿÿÿN(tunittest_import_pb2(t unittest_pb2cCs|jjdkS(Ntproto2(t DESCRIPTORtsyntax(tmessage((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytIsProto27scCsrd|_d|_d|_d|_d|_d|_d|_d|_d |_d |_ d |_ d |_ t |_ d |_d|_t|ƒr¢d|j_nd|j_d|j_d|j_d|j_tjj|_tj|_ t|ƒrt!j"|_#nd|_$d|_%|j&j'dƒ|j(j'dƒ|j)j'dƒ|j*j'dƒ|j+j'dƒ|j,j'dƒ|j-j'dƒ|j.j'dƒ|j/j'dƒ|j0j'dƒ|j1j'd ƒ|j2j'd!ƒ|j3j't ƒ|j4j'd"ƒ|j5j'd#ƒt|ƒr+d$|j6j7ƒ_nd%|j8j7ƒ_d&|j9j7ƒ_d'|j:j7ƒ_d(|j;j7ƒ_|j<j'tjj=ƒ|j>j'tj?ƒt|ƒr¾|j@j't!jAƒn|jBj'd)ƒ|jCj'd*ƒ|j&j'd+ƒ|j(j'd+ƒ|j)j'd+ƒ|j*j'd+ƒ|j+j'd+ƒ|j,j'd+ƒ|j-j'd+ƒ|j.j'd+ƒ|j/j'd+ƒ|j0j'd+ƒ|j1j'd+ƒ|j2j'd+ƒ|j3j't ƒ|j4j'd,ƒ|j5j'd-ƒd.|j&d/|j8j7ƒ_d?|j9j7ƒ_d@|j:j7ƒ_dA|j;j7ƒ_|j<j'tjj=ƒtjj|j<d/<|j>j'tjƒt|ƒrX|j@j't!j"ƒn|jBj'dBƒ|jCj'dCƒt|ƒrGdD|_EdE|_FdF|_GdG|_HdH|_IdI|_JdJ|_KdK|_LdL|_MdM|_NdN|_OdO|_PtD|_QdP|_RdQ|_StjjT|_UtjV|_Wt!jX|_YdR|_ZdS|_[ndT|_\dU|j]_dV|_^dW|__dXS(YsmSets every non-lazy field in the message to a unique value. Args: message: A TestAllTypes instance. ieifigihiiijikiliminioipu115t116iuiviwixi~u124u125iÉiÊiËiÌiÍiÎiÏiÐiÑiÒiÓiÔu215t216iÙiÚiÛiÜiãu224u225iu0t0i-ii.i/i0i1i2i3i4i5i6i7i8u315t316i=i>i?i@iGu324u325i‘i’i“i”i•i–i—i˜i™iši›iœt415t416t424t425iYiZt603t604N(`toptional_int32toptional_int64toptional_uint32toptional_uint64toptional_sint32toptional_sint64toptional_fixed32toptional_fixed64toptional_sfixed32toptional_sfixed64toptional_floattoptional_doubletTruet optional_booltoptional_stringtoptional_bytesRt optionalgrouptatoptional_nested_messagetbbtoptional_foreign_messagetctoptional_import_messagetdtoptional_public_import_messageteRt TestAllTypestBAZtoptional_nested_enumt FOREIGN_BAZtoptional_foreign_enumRt IMPORT_BAZtoptional_import_enumtoptional_string_piecet optional_cordtrepeated_int32tappendtrepeated_int64trepeated_uint32trepeated_uint64trepeated_sint32trepeated_sint64trepeated_fixed32trepeated_fixed64trepeated_sfixed32trepeated_sfixed64trepeated_floattrepeated_doublet repeated_booltrepeated_stringtrepeated_bytest repeatedgrouptaddtrepeated_nested_messagetrepeated_foreign_messagetrepeated_import_messagetrepeated_lazy_messagetrepeated_nested_enumtBARtrepeated_foreign_enumt FOREIGN_BARtrepeated_import_enumt IMPORT_BARtrepeated_string_piecet repeated_cordtFalset default_int32t default_int64tdefault_uint32tdefault_uint64tdefault_sint32tdefault_sint64tdefault_fixed32tdefault_fixed64tdefault_sfixed32tdefault_sfixed64t default_floattdefault_doublet default_booltdefault_stringt default_bytestFOOtdefault_nested_enumt FOREIGN_FOOtdefault_foreign_enumt IMPORT_FOOtdefault_import_enumtdefault_string_piecet default_cordt oneof_uint32toneof_nested_messaget oneof_stringt oneof_bytes(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytSetAllNonLazyFields;sô                                                                  cCst|ƒd|j_dS(Ni(Rntoptional_lazy_messageR$(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt SetAllFieldsÚs cCs÷|j}t}t}d||jƒ||j?j(|j@ƒ||jAj(|jBƒ||jCj(d*ƒ||jDj(d+ƒ||j'j(d,ƒ||j)j(d-ƒ||j*j(d.ƒ||j+j(d/ƒ||j,j(d0ƒ||j-j(d1ƒ||j.j(d2ƒ||j/j(d3ƒ||j0j(d4ƒ||j1j(d5ƒ||j2j(d6ƒ||j3j(d7ƒ||j4j(tEƒ||j5j(d8ƒ||j6j(d9ƒd:||j7j8ƒ_d;||j9j8ƒ_d<||j:j8ƒ_d=||j;j8ƒ_d>||j<j8ƒ_||j=j(|jjƒ||j?j(|j!ƒ||jAj(|j#ƒ||jCj(d?ƒ||jDj(d@ƒdA||jFi?i@iGu324u325i‘i’i“i”i•i–i—i˜i™iši›iœu415R u424RiYiZu603RN(at ExtensionsRRtoptional_int32_extensiontoptional_int64_extensiontoptional_uint32_extensiontoptional_uint64_extensiontoptional_sint32_extensiontoptional_sint64_extensiontoptional_fixed32_extensiontoptional_fixed64_extensiontoptional_sfixed32_extensiontoptional_sfixed64_extensiontoptional_float_extensiontoptional_double_extensionRtoptional_bool_extensiontoptional_string_extensiontoptional_bytes_extensiontoptionalgroup_extensionR"t!optional_nested_message_extensionR$t"optional_foreign_message_extensionR&t!optional_import_message_extensionR(t(optional_public_import_message_extensionR*toptional_lazy_message_extensionR+R,toptional_nested_enum_extensionR.toptional_foreign_enum_extensionR0toptional_import_enum_extensiontoptional_string_piece_extensiontoptional_cord_extensiontrepeated_int32_extensionR5trepeated_int64_extensiontrepeated_uint32_extensiontrepeated_uint64_extensiontrepeated_sint32_extensiontrepeated_sint64_extensiontrepeated_fixed32_extensiontrepeated_fixed64_extensiontrepeated_sfixed32_extensiontrepeated_sfixed64_extensiontrepeated_float_extensiontrepeated_double_extensiontrepeated_bool_extensiontrepeated_string_extensiontrepeated_bytes_extensiontrepeatedgroup_extensionREt!repeated_nested_message_extensiont"repeated_foreign_message_extensiont!repeated_import_message_extensiontrepeated_lazy_message_extensiontrepeated_nested_enum_extensionRKtrepeated_foreign_enum_extensionRMtrepeated_import_enum_extensionROtrepeated_string_piece_extensiontrepeated_cord_extensionRRtdefault_int32_extensiontdefault_int64_extensiontdefault_uint32_extensiontdefault_uint64_extensiontdefault_sint32_extensiontdefault_sint64_extensiontdefault_fixed32_extensiontdefault_fixed64_extensiontdefault_sfixed32_extensiontdefault_sfixed64_extensiontdefault_float_extensiontdefault_double_extensiontdefault_bool_extensiontdefault_string_extensiontdefault_bytes_extensionRbtdefault_nested_enum_extensionRdtdefault_foreign_enum_extensionRftdefault_import_enum_extensiontdefault_string_piece_extensiontdefault_cord_extensiontoneof_uint32_extensiontoneof_nested_message_extensiontoneof_string_extensiontoneof_bytes_extension(Rt extensionstpb2t import_pb2((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytSetAllExtensionsßsÐ                                     cCs?d|_d|_d|_d|jtjƒƒn|jd1t(|j?ƒƒ|jd1t(|j@ƒƒ|jd2|j)d3ƒ|jd4|j*d3ƒ|jd5|j+d3ƒ|jd6|j,d3ƒ|jd7|j-d3ƒ|jd8|j.d3ƒ|jd9|j/d3ƒ|jd:|j0d3ƒ|jd;|j1d3ƒ|jd<|j2d3ƒ|jd=|j3d3ƒ|jd>|j4d3ƒ|jt|j5d3ƒ|jd?|j6d3ƒ|jd@|j7d3ƒt|ƒrŽ|jdA|j8d3jƒn|jdB|j9d3jƒ|jdC|j:d3jƒ|jdD|j;d3jƒ|jdE|jAd3jƒ|jtj jB|j<d3ƒ|jtjC|j=d3ƒt|ƒrV |jt%jD|j>d3ƒn|jdF|j)dGƒ|jdH|j*dGƒ|jdI|j+dGƒ|jdJ|j,dGƒ|jdK|j-dGƒ|jdL|j.dGƒ|jdM|j/dGƒ|jdN|j0dGƒ|jdO|j1dGƒ|jdP|j2dGƒ|jdQ|j3dGƒ|jdR|j4dGƒ|jtE|j5dGƒ|jdS|j6dGƒ|jdT|j7dGƒt|ƒrØ |jdU|j8dGjƒn|jdV|j9dGjƒ|jdW|j:dGjƒ|jdX|j;dGjƒ|jdY|jAdGjƒ|jtj j!|j<dGƒ|jtj#|j=dGƒt|ƒr  |jt%j&|j>dGƒnt|ƒr|j|jdZƒƒ|j|jd[ƒƒ|j|jd\ƒƒ|j|jd]ƒƒ|j|jd^ƒƒ|j|jd_ƒƒ|j|jd`ƒƒ|j|jdaƒƒ|j|jdbƒƒ|j|jdcƒƒ|j|jddƒƒ|j|jdeƒƒ|j|jdfƒƒ|j|jdgƒƒ|j|jdhƒƒ|j|jdiƒƒ|j|jdjƒƒ|j|jdkƒƒ|jdl|jFƒ|jdm|jGƒ|jdn|jHƒ|jdo|jIƒ|jdp|jJƒ|jdq|jKƒ|jdr|jLƒ|jds|jMƒ|jdt|jNƒ|jdu|jOƒ|jdv|jPƒ|jdw|jQƒ|jtE|jRƒ|jdx|jSƒ|jdy|jTƒ|jtj jU|jVƒ|jtjW|jXƒ|jt%jY|jZƒndzS({sFCheck all fields for correct values have after Set*Fields() is called.RRRRRRRRRRRRRRR R!R#R%R'R"R$R&R(R-R/R1R2R3ieifigihiiijikiliminioipt115Riuiviwixi~iiiÉiiÊiËiÌiÍiÎiÏiÐiÑiÒiÓiÔt215RiÙiÚiÛiÜiãi-ii.i/i0i1i2i3i4i5i6i7i8t315R i=i>i?i@iGRSRTRURVRWRXRYRZR[R\R]R^R_R`RaRcReRgi‘i’i“i”i•i–i—i˜i™iši›iœR R N([t assertTruetHasFieldRR!R#R%R't assertEqualRRRRRRRRRRRRRRRR R"R$R&R(R)R*RoRR+R,R-R.R/RR0R1tlenR4R6R7R8R9R:R;R<R=R>R?R@RARBRCRDRFRGRHRJRLRNRPRQRIRKRMRORRRSRTRURVRWRXRYRZR[R\R]R^R_R`RaRbRcRdReRfRg(t test_caseR((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytExpectAllFieldsSet˜sj                        cCsÇd}xqtjj|ƒrytjjtjj|dƒƒratjj|d|ƒ}t|dƒStjj|dƒ}q Wd}tjj|d|ƒ}tjj|ƒr·t|dƒStdƒ‚dS( sFFinds the given golden file and returns a file object representing it.t.ssrc/google/protobufssrc/google/protobuf/testdatatrbs..s'third_party/py/google/protobuf/testdatas™Could not find golden files. This test must be run from within the protobuf source package so that it can read test data files from the C++ source tree.N(tostpathtexistsRÍtopent RuntimeError(tfilenameRßt full_path((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt GoldenFileis!   cCs#t|ƒ}|jƒSWdQXdS(s5Finds the given golden file and returns its contents.N(Råtread(Rãtf((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytGoldenFileDataƒscCs>|jjddgƒ|jjddgƒ|jjddgƒ|jjddgƒ|jjd d gƒ|jjd d gƒ|jjd dgƒ|jjddgƒ|j jddgƒ|j jddgƒ|j jddgƒ|j jddgƒ|j jttgƒ|jjtjtjgƒdS(sgSets every field in the message to a unique value. Args: message: A TestPackedTypes instance. iYi½iZi¾i[i¿i\iÀi]iÁi^iÂi_iÃi`iÄiaiÅibiÆgƒ@g8†@g ƒ@g@†@N(t packed_int32textendt packed_int64t packed_uint32t packed_uint64t packed_sint32t packed_sint64tpacked_fixed32tpacked_fixed64tpacked_sfixed32tpacked_sfixed64t packed_floatt packed_doublet packed_boolRRRt packed_enumRRMR.(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytSetAllPackedFields‰scCs…|j}t}||jjddgƒ||jjddgƒ||jjddgƒ||jjddgƒ||jjd d gƒ||jjd d gƒ||j jd dgƒ||j jddgƒ||j jddgƒ||j jddgƒ||j jddgƒ||jjddgƒ||jjttgƒ||jjtjtjgƒdS(s}Sets every extension in the message to a unique value. Args: message: A unittest_pb2.TestPackedExtensions instance. iYi½iZi¾i[i¿i\iÀi]iÁi^iÂi_iÃi`iÄiaiÅibiÆgƒ@g8†@g ƒ@g@†@N(RqRtpacked_int32_extensionRêtpacked_int64_extensiontpacked_uint32_extensiontpacked_uint64_extensiontpacked_sint32_extensiontpacked_sint64_extensiontpacked_fixed32_extensiontpacked_fixed64_extensiontpacked_sfixed32_extensiontpacked_sfixed64_extensiontpacked_float_extensiontpacked_double_extensiontpacked_bool_extensionRRRtpacked_enum_extensionRMR.(RR½R¾((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytSetAllPackedExtensions s" cCs>|jjddgƒ|jjddgƒ|jjddgƒ|jjddgƒ|jjd d gƒ|jjd d gƒ|jjd dgƒ|jjddgƒ|j jddgƒ|j jddgƒ|j jddgƒ|j jddgƒ|j jttgƒ|jjtjtjgƒdS(svSets every field in the message to a unique value. Args: message: A unittest_pb2.TestUnpackedTypes instance. iYi½iZi¾i[i¿i\iÀi]iÁi^iÂi_iÃi`iÄiaiÅibiÆgƒ@g8†@g ƒ@g@†@N(tunpacked_int32Rêtunpacked_int64tunpacked_uint32tunpacked_uint64tunpacked_sint32tunpacked_sint64tunpacked_fixed32tunpacked_fixed64tunpacked_sfixed32tunpacked_sfixed64tunpacked_floattunpacked_doublet unpacked_boolRRRt unpacked_enumRRMR.(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pytSetAllUnpackedFieldsºstNonStandardIntegercBs‚eZdZd*d„Zd„Zd„Zd„Zd„Zd„Z d„Z d„Z d „Z d „Z d „Zd „Zd „Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Zd„Z d„Z!d„Z"d „Z#d!„Z$d"„Z%d#„Z&d$„Z'd%„Z(d&„Z)d'„Z*d(„Z+d)„Z,RS(+sÝAn integer object that does not subclass int. This is used to verify that both C++ and regular proto systems can handle integer others than int and long and that they handle them in predictable ways. NonStandardInteger is the minimal legal specification for a custom Integral. As such, it does not support 0 < x < 5 and it is not hashable. Note: This is added here instead of relying on numpy or a similar library with custom integers to limit dependencies. cCs1t|tƒr|j}n||_||_dS(N(t isinstanceRtvalterror_string_on_conversion(tselfRR((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__init__ßs  cCs(|jrt|jƒ‚nt|jƒS(N(RRâtlongR(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__long__æs cCsttj|jƒƒS(N(RtoperatortabsR(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__abs__ëscCsttj|j|ƒƒS(N(RRRER(Rty((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__add__îscCsttj|j|ƒƒS(N(RRtdivR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__div__ñscCstj|j|ƒS(N(RteqR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__eq__ôscCsttj|j|ƒƒS(N(RRtfloordivR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __floordiv__÷scCsttj|j|ƒƒS(N(RRttruedivR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __truediv__úscCsttj|jƒƒS(N(RRtinvertR(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __invert__ýscCsttj|j|ƒƒS(N(RRtmodR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__mod__scCsttj|j|ƒƒS(N(RRtmulR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__mul__scCsttj|jƒƒS(N(RRtnegR(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__neg__scCsttj|jƒƒS(N(RRtposR(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__pos__ scCsttj|j|ƒƒS(N(RRtpowR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__pow__ scCs t|jƒS(N(tintR(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __trunc__scCsttj||jƒƒS(N(RRRER(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__radd__scCsttj||jƒƒS(N(RRR$R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__rdiv__scCsttj||jƒƒS(N(RRR.R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__rmod__scCsttj||jƒƒS(N(RRR0R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__rmul__scCsttj||jƒƒS(N(RRR6R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__rpow__scCsttj||jƒƒS(N(RRR(R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __rfloordiv__!scCsttj||jƒƒS(N(RRR*R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __rtruediv__$scCsttj|j|ƒƒS(N(RRtlshiftR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __lshift__'scCsttj|j|ƒƒS(N(RRtrshiftR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __rshift__*scCsttj||jƒƒS(N(RRRAR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __rlshift__-scCsttj||jƒƒS(N(RRRCR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __rrshift__0scCs.t|tƒr|j}ntj|j|ƒS(N(RRRRtle(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__le__3s cCs.t|tƒr|j}ntj|j|ƒS(N(RRRRtlt(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__lt__8s cCsttj|j|ƒƒS(N(RRtand_R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__and__=scCsttj|j|ƒƒS(N(RRtor_R(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__or__@scCsttj|j|ƒƒS(N(RRtxorR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__xor__CscCsttj||jƒƒS(N(RRRKR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__rand__FscCsttj||jƒƒS(N(RRRMR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__ror__IscCsttj||jƒƒS(N(RRROR(RR"((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__rxor__LscCs|jS(N(R(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__bool__OscCs|jS(N(R(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __nonzero__RscCs|S(N((R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__ceil__UscCs|S(N((R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __floor__XscCs(|jrt|jƒ‚nt|jƒS(N(RRâR8R(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__int__[s cCs|S(N((R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt __round__`scCs d|jS(NsNonStandardInteger(%s)(R(R((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt__repr__csN(-t__name__t __module__t__doc__tNoneRRR!R#R%R'R)R+R-R/R1R3R5R7R9R:R;R<R=R>R?R@RBRDRERFRHRJRLRNRPRQRRRSRTRURVRWRXRYRZ(((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyRÑsT                                         (R]t __author__tnumbersRtos.pathRÞtgoogle.protobufRRRt NameErrorR8RRnRpRÀRÈRÒRÛRåRèRøRRtIntegralR(((sF/usr/lib/python2.7/site-packages/google/protobuf/internal/test_util.pyt#s.       Ÿ  Ž  Ñ