Your IP : 172.28.240.42


Current Path : /usr/lib/python2.7/dist-packages/twisted/internet/test/
Upload File :
Current File : //usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyc


=Nc@sddlZddlZddlmZddlmZmZyejWnek
rbdZ	nXdZ	defdYZdefdYZ
d	eje
fd
YZdeje
fdYZd
ejefdYZdS(iN(tunittest(tIPv4AddresstUNIXAddresss"Platform does not support symlinkstAddressTestCaseMixincBsGeZdZdZdZdZdZdZdZRS(cCsB|j|j|jk|j|j|jkdS(s
        Two different address instances, sharing the same properties are
        considered equal by C{==} and not considered not equal by C{!=}.

        Note: When applied via UNIXAddress class, this uses the same
        filename for both objects being compared.
        N(t
assertTruetbuildAddresstassertFalse(tself((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyttest_addressComparisonsc		Cs|j}djddddddg}||}tj||}|jd
|d|f|j|jj|j	d	g|j	d
j
dD]}|j^q}|j|g|jD]$}|d	t
||df^qd
S(s
        Verify that the string representation of an address object conforms to a
        simple pattern (the usual one for Python object reprs) and contains
        values which accurately reflect the attributes of the address.
        tt^s([^\(]+Address)s\(s([^)]+)s\)t$sI%s does not match the standard __str__ pattern ClassName(arg1, arg2, etc)iit,iN(RtjointretmatchtassertNotEqualstNonetassertEqualt	__class__t__name__tgrouptsplittstriptaddressArgSpectgetattr(	RtstringFunctiontaddrtpatterntstringValuetmtxtargstargSpec((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyt_stringRepresentations&1cCs|jtdS(s
        C{str} can be used to get a string representation of an address instance
        containing information about that address.
        N(R"tstr(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyttest_str<scCs|jtdS(s
        C{repr} can be used to get a string representation of an address
        instance containing information about that address.
        N(R"trepr(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyt	test_reprDscCs4|j}it|6}|j||jdS(s
        C{__hash__} can be used to get a hash of an address, allowing
        addresses to be used as keys in dictionaries, for instance.
        N(RtTrueR(RRtd((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyt	test_hashLs
cCsB|j|j|jk|j|j|jkdS(s~
        Check that comparison operators work correctly on address objects
        when a different name is passed in
        N(RRtbuildDifferentAddressR(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyttest_differentNamesComparisonVscCs\|j|g}|j|ddt|j|dd||jt|ddS(s{
        Assert that the a DeprecationWarning with the given message was
        emitted against the given method.
        itcategorytmessageiN(t
flushWarningsRtDeprecationWarningtlen(Rt
testMethodR-twarnings((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pytassertDeprecations_s(	Rt
__module__RR"R$R&R)R+R3(((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyRs					
		tIPv4AddressTestCaseMixincBseZdddfZRS(	ttypes%sthosts%rtports%d(stypes%s(shosts%r(R8s%d(RR4R(((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR5kstIPv4AddressTCPTestCasecBs#eZdZdZdZRS(cCstdddS(s
        Create an arbitrary new L{IPv4Address} instance with a C{"TCP"}
        type.  A new instance is created for each call, but always for the
        same address.
        tTCPs	127.0.0.1i(R(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyRqscCstdddS(sK
        Like L{buildAddress}, but with a different fixed address.
        R:s	127.0.0.2i(R(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR*zscCs1d}tddddd}|j|j|S(s
        If a value is passed for the C{_bwHack} parameter to L{IPv4Address},
        a deprecation warning is emitted.
        sMtwisted.internet.address.IPv4Address._bwHack is deprecated since Twisted 11.0R:s	127.0.0.3it_bwHack(RR3ttest_bwHackDeprecation(RR-taddress((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR<s(RR4RR*R<(((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR9ps			tIPv4AddressUDPTestCasecBs#eZdZdZdZRS(cCstdddS(s
        Create an arbitrary new L{IPv4Address} instance with a C{"UDP"}
        type.  A new instance is created for each call, but always for the
        same address.
        tUDPs	127.0.0.1i(R(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyRscCstdddS(sK
        Like L{buildAddress}, but with a different fixed address.
        R?s	127.0.0.2i(R(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR*scCs1d}tddddd}|j|j|S(s
        If a value is passed for the C{_bwHack} parameter to L{IPv4Address},
        a deprecation warning is emitted.
        sMtwisted.internet.address.IPv4Address._bwHack is deprecated since Twisted 11.0R?s	127.0.0.3iR;(RR3R<(RR-R=((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR<s(RR4RR*R<(((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR>s			tUNIXAddressTestCasecBsVeZd	ZdZdZdZdZee_dZ	ee	_dZ
RS(
tnames%rcCs"|j|_|j|_dS(N(tmktempt_socketAddresst
_otherAddress(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pytsetUpscCs
t|jS(s
        Create an arbitrary new L{UNIXAddress} instance.  A new instance is
        created for each call, but always for the same address.
        (RRC(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyRscCs
t|jS(sK
        Like L{buildAddress}, but with a different fixed address.
        (RRD(R((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR*scCsf|j}t|jd|_tjtjj|j||jt	|jt	|kdS(sU
        UNIXAddress objects compare as equal if they link to the same file.
        twN(
RBtopenRCtfdtostsymlinktpathtabspathRR(RtlinkName((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyttest_comparisonOfLinkedFiless
cCso|j}t|jd|_tjtjj|j||jt	t
|jt	t
|dS(sU
        UNIXAddress Objects that compare as equal have the same hash value.
        RFN(RBRGRCRHRIRJRKRLRthashR(RRM((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyttest_hashOfLinkedFiless
cCs1d}t|jdd}|j|j|S(s
        If a value is passed for the C{_bwHack} parameter to L{UNIXAddress},
        a deprecation warning is emitted.
        sMtwisted.internet.address.UNIXAddress._bwHack is deprecated since Twisted 11.0R;tUNIX(RRBR3R<(RR-R=((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR<s(snames%r((snames%r(RR4RRERR*RNtsymlinkSkiptskipRPR<(((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyR@s									(RRIt
twisted.trialRttwisted.internet.addressRRRJtAttributeErrorRRRtobjectRR5tTestCaseR9R>R@(((sF/usr/lib/python2.7/dist-packages/twisted/internet/test/test_address.pyt<module>s

Y