Current File : //proc/self/root/lib/python3/dist-packages/twisted/words/test/__pycache__/test_irc.cpython-312.pyc
�

Ϫ�f����dZddlZddlZddlZddlmZmZddlmZm	Z	ddl
mZddlm
Z
ddlmZddlmZmZGd	�d
e
�ZGd�de�ZGd
�de�ZGd�de�ZGd�de�Zddj3ej4��dj3ej6ej8��dej:ej<d�zgZGd�de�Z Gd�dejB�Z"Gd�de�Z#Gd �d!e�Z$Gd"�d#ej"�Z%Gd$�d%e�Z&Gd&�d'e%�Z'd(�Z(Gd)�d*e�Z)Gd+�d,e�Z*Gd-�d.ej"�Z+Gd/�d0e�Z,Gd1�d2e�Z-Gd3�d4e�Z.Gd5�d6ej"�Z/Gd7�d8e�Z0Gd9�d:e�Z1Gd;�d<e�Z2Gd=�d>e�Z3Gd?�d@e�Z4GdA�dBe�Z5y)Cz+
Tests for L{twisted.words.protocols.irc}.
�N)�protocol�task)�StringIOWithoutClosing�StringTransport)�FilePath)�TestCase)�irc)�	IRCClient�
attributesc��eZdZd�Zy)�IRCTestCasec��|}t|t�r|jd�}t|t�r1t|dt�r|D�cgc]}|jd���}}|j	||�ycc}w)a$
        A buffer is always bytes, but sometimes
        we need to compare it to a utf-8 unicode string

        @param buf: the buffer
        @type buf: L{bytes} or L{unicode} or L{list}
        @param val: the value to compare
        @type val: L{bytes} or L{unicode} or L{list}
        �utf-8r�utf8N)�
isinstance�str�decode�list�assertEqual)�self�buf�val�bufferValue�bs     �=/usr/lib/python3/dist-packages/twisted/words/test/test_irc.py�assertEqualBufferValuez"IRCTestCase.assertEqualBufferValuesm�����c�3��%�,�,�W�5�K��k�4�(��#�a�&�#�&�9D�E�A�q�x�x��/�E��E�����c�*��Fs�A8N)�__name__�
__module__�__qualname__r��rr
r
s��+r!r
c�P�eZdZdZdZd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zy
)�ModeParsingTestsz>
    Tests for L{twisted.words.protocols.irc.parseModes}.
    )�klbrc�d�|jtjtjdg�y)zI
        Parsing an empty mode string raises L{irc.IRCBadModes}.
        �N��assertRaisesr	�IRCBadModes�
parseModes�rs r�test_emptyModesz ModeParsingTests.test_emptyModes0s ��	
���#�/�/�3�>�>�2�r�Br!c��|jtjtjdg�|jtjtjdg�|jtjtjdg�|jtjtjdg�y)z�
        Parsing a mode string that contains an empty sequence (either a C{+} or
        C{-} followed directly by another C{+} or C{-}, or not followed by
        anything at all) raises L{irc.IRCBadModes}.
        z++kz-+k�+�-Nr'r+s r�test_emptyModeSequencez'ModeParsingTests.test_emptyModeSequence6st��	
���#�/�/�3�>�>�5�"�E����#�/�/�3�>�>�5�"�E����#�/�/�3�>�>�3��C����#�/�/�3�>�>�3��Cr!c���|jtjtjdg�|jtjtjdg�y)zp
        Parsing a mode string that does not start with C{+} or C{-} raises
        L{irc.IRCBadModes}.
        �foo�%Nr'r+s r�test_malformedModesz$ModeParsingTests.test_malformedModesAs<��
	
���#�/�/�3�>�>�5�"�E����#�/�/�3�>�>�3��Cr!c���|jtjtjdg�|jtjtjdg�y)zk
        Parsing a mode string that contains no mode characters raises
        L{irc.IRCBadModes}.
        r.r/Nr'r+s r�test_nullModeszModeParsingTests.test_nullModesIs<��
	
���#�/�/�3�>�>�3��C����#�/�/�3�>�>�3��Cr!c��tjdg�\}}|j|dg�|j|g�tjdg�\}}|j|g�|j|dg�y)z�
        Parsing a single mode setting with no parameters results in that mode,
        with no parameters, in the "added" direction and no modes in the
        "removed" direction.
        �+s��sN�-sN�r	r*r�r�added�removeds   r�test_singleModez ModeParsingTests.test_singleModeQsp������b�1���w������
�.�����"�%�����b�1���w������#�����;�-�0r!c��tjdg�\}}|j|gd��|j|g�tjdg�\}}|j|g�|j|ddg�y)z�
        Parsing a single-direction mode setting with multiple modes and no
        parameters, results in all modes falling into the same direction group.
        z+stn)r9��tN��nNz-ntrDrBNr<r=s   r�test_singleDirectionz%ModeParsingTests.test_singleDirection_sr��
�����3���w����� G�H�����"�%�����r�2���w������#�����;��"<�=r!c��tjdg�\}}|j|gd��|j|dg�y)zL
        Parsing a multi-direction mode setting with no parameters.
        z+s-n+ti)r9rB��iNrDNr<r=s   r�test_multiDirectionz$ModeParsingTests.test_multiDirectionls;�����	�2�6���w����� G�H�����;�-�0r!c��tjdg�\}}|j|gd��|j|g�y)z�
        Parsing a multi-direction mode setting containing two consecutive mode
        sequences with the same direction results in the same result as if
        there were only one mode sequence in the same direction.
        z+sn+ti)r9rDrBrHNr<r=s   r�test_consecutiveDirectionz*ModeParsingTests.test_consecutiveDirectionts9������"�5���w����� T�U�����"�%r!c���|jtjtjdg|j�|jtjtjdgd�|j�y)z�
        If the number of mode parameters does not match the number of modes
        expecting parameters, L{irc.IRCBadModes} is raised.
        z+kz+kl)r2�10�lulz_extra_paramN)r(r	r)r*�
paramModesr+s r�test_mismatchedParamsz&ModeParsingTests.test_mismatchedParams~sO��
	
���#�/�/�3�>�>�4��T�_�_�U�����O�O��N�N��-��O�O�	
r!c���tjdgd�|j�\}}|j|gd��|j|g�tjdddg|j�\}}|j|g�|j|gd��tjdgd	�|j�\}}|j|gd
��|j|g�y)z�
        Modes which require parameters are parsed and paired with their relevant
        parameter, modes which do not require parameters do not consume any of
        the parameters.
        z+klbb)�somekey�42�nick!user@host�	other!*@*)��krS)�lrT�rrU�rrVz-klbbrUrV))rXN)rYNrZr[z+knbb)rSrUrV)rWrDrZr[N)r	r*rPrr=s   r�test_parametersz ModeParsingTests.test_parameters�s�������E�t���
���w�	
����
�	
�	
����"�%�����&��4�d�o�o�
���w�	
�����#�����S�	
�����?����
���w�	
����
�	
�	
����"�%r!N)rrr�__doc__rPr,r0r4r6r@rFrJrLrQr\r r!rr#r#)sD����J�C�	D�D�D�1�>�1�&�
�*&r!r#c��eZdZdZd�Zy)�	MiscTestsz,
    Tests for miscellaneous functions.
    c
���|jtjtjdgd��d�d�}|jtj|gdgdgdgdgg�gdgdgdgdg�y	)
z�
        Apply a function of two arguments cumulatively to the items of
        a sequence, from right to left, so as to reduce the sequence to
        a single value.
        r)�������c�*�|jd|�|S)Nr)�insert)rY�xs  r�	insertTopz'MiscTests.test_foldr.<locals>.insertTop�s��
�H�H�Q��N��Hr!rarbrcrdN)rr	�_foldr�operator�sub)rris  r�
test_foldrzMiscTests.test_foldr�sp��	
������H�L�L�!�\�B�B�G�	�	
����J�J�y�"��s�Q�C�!��q�c�&:�;��Q���|�Q�>O�QR�=S�	
r!N)rrrr]rmr r!rr_r_�s���
r!r_c�|�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�FormattedTextTestsz>
    Tests for parsing and assembling formatted IRC text.
    c�R�tj|�}|j||�y)a+
        Assert that C{text} is parsed and assembled to the same value as what
        C{expectedFormatted} is assembled to. This provides a way to ignore
        meaningless differences in the formatting structure that would be
        difficult to detect without rendering the structures.
        N)r	�parseFormattedText�assertAssemblesTo)r�text�expectedFormatted�	formatteds    r�assertAssembledEquallyz)FormattedTextTests.assertAssembledEqually�s%���*�*�4�0�	����y�*;�<r!c��tj|�}tj|�}|jtj|�||�d|�d|�d|�d��y)zg
        Assert that C{formatted} and C{expectedFormatted} assemble to the same
        value.
        z (z) is not equivalent to �)N)r	�assembleFormattedTextr)rrurtrs�expectedTexts     rrrz$FormattedTextTests.assertAssemblesTo�sT��
�(�(��3���0�0�1B�C������%�%�i�0���Y��.?�
A�	
r!c�D�|jdtj�y)zO
        An empty string parses to a I{normal} attribute with no text.
        r&N)rv�A�normalr+s r�test_parseEmptyz"FormattedTextTests.test_parseEmpty�s��	
�#�#�B����1r!c���|jtjtj�d�|jtjtj
d�d�y)z�
        An attribute with no text assembles to the empty string. An attribute
        whose text is the empty string assembles to two control codes: C{off}
        and that of the attribute.
        r&zN)rr	ryr|r}�boldr+s r�test_assembleEmptyz%FormattedTextTests.test_assembleEmpty�sH��	
����2�2�1�8�8�<�b�A�	
����2�2�1�6�6�"�:�>�
�Kr!c�p�|jtjtjd�d�y)zi
        A I{normal} string assembles to a string prefixed with the I{off}
        control code.
        �hellozhelloN)rr	ryr|r}r+s r�test_assembleNormalz&FormattedTextTests.test_assembleNormal�s(��
	
����2�2�1�8�8�G�3D�E�{�Sr!c�p�|jtjtjd�d�y)zt
        A I{bold} string assembles to a string prefixed with the I{off} and
        I{bold} control codes.
        r�zhelloN)rr	ryr|r�r+s r�test_assembleBoldz$FormattedTextTests.test_assembleBolds'��
	
����2�2�1�6�6�'�?�C�_�Ur!c�p�|jtjtjd�d�y)z
        An I{underline} string assembles to a string prefixed with the I{off}
        and I{underline} control codes.
        r�zhelloN)rr	ryr|�	underliner+s r�test_assembleUnderlinez)FormattedTextTests.test_assembleUnderlines+��
	
����%�%�a�k�k�'�&:�;�_�	
r!c�p�|jtjtjd�d�y)z�
        A I{reverse video} string assembles to a string prefixed with the I{off}
        and I{reverse video} control codes.
        r�zhelloN)rr	ryr|�reverseVideor+s r�test_assembleReverseVideoz,FormattedTextTests.test_assembleReverseVideos+��
	
����%�%�a�n�n�W�&=�>��	
r!c��|jtjtjj
d�d�y)z�
        A I{foreground color} string assembles to a string prefixed with the
        I{off} and I{color} (followed by the relevant foreground color code)
        control codes.
        r�z	02helloN)rr	ryr|�fg�bluer+s r�test_assembleForegroundColorz/FormattedTextTests.test_assembleForegroundColors0��	
����%�%�a�d�d�i�i��&8�9�;L�	
r!c��|jtjtjj
d�d�y)a
        A I{background color} string assembles to a string prefixed with the
        I{off} and I{color} (followed by a I{,} to indicate the absence of a
        foreground color, followed by the relevant background color code)
        control codes.
        r�z
,02helloN)rr	ryr|�bgr�r+s r�test_assembleBackgroundColorz/FormattedTextTests.test_assembleBackgroundColor(s0��	
����%�%�a�d�d�i�i��&8�9�;M�	
r!c��|jtjtjj
tjjd�d�y)z�
        A I{foreground} and I{background} color string assembles to a string
        prefixed with the I{off} and I{color} (followed by the relevant
        foreground color, I{,} and the relevant background color code) control
        codes.
        r�z05,02helloN)rr	ryr|r��redr�r�r+s r�test_assembleColorz%FormattedTextTests.test_assembleColor3s=��	
����%�%�a�d�d�h�h�q�t�t�y�y��/A�&B�C� �	
r!c��|jtjtjdtj
df�d�|jtjtjtjjtjjddftjdf�d�y)zK
        Nested attributes retain the attributes of their parents.
        r�� worldzhello worldz yayz05,03hello05 world yayN)rr	ryr|r�r�r}r�r�r��greenr�r+s r�test_assembleNestedz&FormattedTextTests.test_assembleNested?s���	
����%�%�a�f�f�W�a�k�k�(�6K�-K�&L�M�-�	
�
	
����%�%�����D�D�H�H�Q�T�T�Z�Z��0�(�:�;�Q�^�^�F�=S�S��
�

=�
	
r!c�p�|jtjd�tjd�y)zk
        Parsing unformatted text results in text with attributes that
        constitute a no-op.
        r�N)rr	rqr|r}r+s r�test_parseUnformattedTextz,FormattedTextTests.test_parseUnformattedTextQs(��
	
����/�/��8�!�(�(�7�:K�Lr!c���|jtjd�tjj
d�|jtjd�tjj
tjjd�|jtjd�tjj
dtjjdf�y)z
        Correctly formatted text with colors uses 2 digits to specify
        foreground and (optionally) background.
        z01yay�yayz
01,02yayz01yay02yipee�yipeeN)rr	rqr|r��blackr�r�r+s r�test_colorFormattingz'FormattedTextTests.test_colorFormattingXs���
	
����/�/��@�!�$�$�*�*�U�BS�T�����"�"�#5�6����
�
�1�4�4�9�9�U�CS�8T�	
�	
����"�"�#=�>�
�D�D�J�J�u�a�d�d�i�i��0�0�1�	
r!c��|jdtjjd�|jdtjjd�|jdtjjtj
jd�|jdtjjtj
jd�|jdtjjtj
jd	�|jd
tjd�|jdtjd
�|jdtjjd�|jdtj�y)a�
        Formatted text with colors can use 1 digit for both foreground and
        background, as long as the text part does not begin with a digit.
        Foreground and background colors are only processed to a maximum of 2
        digits per component, anything else is treated as text. Color sequences
        must begin with a digit, otherwise processing falls back to unformatted
        text.
        z
1kinda validzkinda validz999,999kinda validz9,999kinda validz1,2kinda validz1,999kinda validz9kinda validz1,242 is a special numberz2 is a special numberz	,02oopsz,02oopszwrong�wrongz1,hellor�zN)	rvr|r�r�r�r�r��yellowr}r+s r�test_weirdColorFormattingz,FormattedTextTests.test_weirdColorFormattingfs8��	
�#�#�$6����
�
�=�8Q�R��#�#�$�a�d�d�j�j�1C�&D�	
�	
�#�#� �!�$�$�*�*�Q�T�T�Y�Y�}�-E�"F�	
�	
�#�#�"�A�D�D�J�J�q�t�t�z�z�.�/I�$J�	
�	
�#�#�+�
�D�D�J�J�q�t�t�{�{�#:�;�<�	
�	
�#�#�$5�q�x�x�	�7J�K��#�#�K����'�1B�C��#�#�M�1�4�4�:�:�g�3F�G��#�#�J����9r!c�:�|jdtjtjjddf�|jdtjtjjtj
jddf�y)zb
        An empty color format specifier clears foreground and background
        colors.
        z01yayresetr��resetz01,02yayresetN)rvr|r}r�r�r�r�r+s r�test_clearColorFormattingz,FormattedTextTests.test_clearColorFormatting�so��
	
�#�#� �!�(�(�1�4�4�:�:�e�+<�g�+E�"F�	
�	
�#�#�#�Q�X�X�a�d�d�j�j������5�9I�.J�G�.S�%T�	
r!c���|jdtjtjtjddf�|jdtjtj
jddf�|jdtjtj
jtjjddf�y)zL
        A reset format specifier clears all formatting attributes.
        zyayresetr�r�z01yayresetz01,02yayresetN)	rvr|r}r�r�r�r�r�r�r+s r�test_resetFormattingz'FormattedTextTests.test_resetFormatting�s���	
�#�#�"�A�H�H�Q�V�V�A�K�K��4F�-G��-P�$Q�	
�	
�#�#� �!�(�(�1�4�4�:�:�e�+<�g�+E�"F�	
�	
�#�#�#�Q�X�X�a�d�d�j�j������5�9I�.J�G�.S�%T�	
r!c�J�|jtjtjtj
tjtjtjjtjjddf��d�y)zZ
        Strip formatting codes from formatted text, leaving only the text parts.
        r�r�zhello worldN)rr	�stripFormattingryr|r�r�r�r�r�r�r�r+s r�test_stripFormattingz'FormattedTextTests.test_stripFormatting�sv��	
�������)�)��F�F�����N�N�1�4�4�8�8�A�D�D�J�J�w�4G�+H�I�8�S����
�
�	
r!N)rrrr]rvrrr~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r r!rroro�se���=�
�2�
L�T�V�
�
�
�	
�

�
�$M�
�:�8

�
�
r!roc��eZdZdZd�Zy)�FormattingStateAttributeTestszD
    Tests for L{twisted.words.protocols.irc._FormattingState}.
    c��|jtj�tj��|jtj�tjd���|jtjddddtjd��tjddddtjd���|j	tjd��tjd���y)z�
        L{irc._FormattingState}s must have matching character attribute
        values (bold, underline, etc) with the same values to be considered
        equal.
        F)�offTr�)r�r�r�r��
foreground)r�N)rr	�_FormattingState�_IRC_COLORS�assertNotEqualr+s r�
test_equalityz+FormattingStateAttributeTests.test_equality�s���	
����-�-�/��1E�1E�1G�H�����-�-�/��1E�1E�%�1P�Q����� � ����!��?�?�6�2�
�
� � ����!��?�?�6�2�
�	
�"	
���� � �d�+�S�-A�-A�u�-M�	
r!N)rrrr]r�r r!rr�r��s���
r!r�z3Hello, this is a nice string with no complications.z!xargs{NUL}might{NUL}like{NUL}this)�NULz"embedded{CR}newline{CR}{NL}FUN{NL})�CR�NLz,escape!%(X)s escape!%(M)s %(X)s%(X)sa %(M)s0)�X�Mc��eZdZd�Zd�Zy)�QuotingTestsc	��tD]:}|j|tjtj|����<y)z<
        Testing client-server level quote/dequote.
        N)�stringSubjectsrr	�
lowDequote�lowQuote�rr:s  r�test_lowquoteSanityz QuotingTests.test_lowquoteSanity�s6�� �	A�A����Q����s�|�|�A�� ?�@�	Ar!c	��tD]:}|j|tjtj|����<y)z;
        Testing CTCP message level quote/dequote.
        N)r�rr	�ctcpDequote�	ctcpQuoter�s  r�test_ctcpquoteSanityz!QuotingTests.test_ctcpquoteSanity�s7�� �	C�A����Q�����
�
�a�0@� A�B�	Cr!N)rrrr�r�r r!rr�r��s��A�Cr!r�c� �eZdZdZdZd�Zd�Zy)�
DispatcherzS
    A dispatcher that exposes one known command and handles unknown commands.
    �dispc�
�||fS)z9
        A known command that returns its input.
        r )r�ars   r�disp_workingzDispatcher.disp_working�s
���!�t�r!c��|||fS)zM
        Handle unknown commands by returning their name and inputs.
        r )r�namer�rs    r�disp_unknownzDispatcher.disp_unknown�s���Q��z�r!N)rrrr]�prefixr�r�r r!rr�r��s����F��r!r�c�"�eZdZdZd�Zd�Zd�Zy)�DispatcherTestsz3
    Tests for L{irc._CommandDispatcherMixin}.
    c�f�t�}d}|jdg|���}|j||�y)zD
        Dispatching a command invokes the correct handler.
        �rarb�workingN�r��dispatchr)rr��args�ress    r�
test_dispatchzDispatcherTests.test_dispatchs5���|�����d�m�m�I�-��-������d�#r!c�r�t�}d}d}|j|g|���}|j||f|z�y)zM
        Dispatching an unknown command invokes the default handler.
        �missingr�Nr�)rr�r�r�r�s     r�test_dispatchUnknownz$DispatcherTests.test_dispatchUnknowns@���|�������d�m�m�D�(�4�(������t�g��n�-r!c�|�t�}d|_|jtj|j
d�y)z�
        Dispatching an unknown command, when no default handler is present,
        results in an exception being raised.
        N�bar)r�r�r(r	�UnhandledCommandr�)rr�s  r�test_dispatchMissingUnknownz+DispatcherTests.test_dispatchMissingUnknowns/��
�|�� ������#�.�.��
�
�u�Er!N)rrrr]r�r�r�r r!rr�r�s���$�.�Fr!r�c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zdd�Zdd�Z
dd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy
)�ServerSupportedFeatureTestszE
    Tests for L{ServerSupportedFeatures} and related functions.
    c���|jtjd�d�|jtjg�d�|jtjd�d�|jtjdd�d�|jtjd�d�|jtjd�d�y)zt
        L{_intOrDefault} converts values to C{int} if possible, otherwise
        returns a default value.
        Nr&r���123�{)rr	�
_intOrDefaultr+s r�test_intOrDefaultz-ServerSupportedFeatureTests.test_intOrDefault's���
	
����*�*�4�0�$�7�����*�*�2�.��5�����*�*�2�.��5�����*�*�7�A�6��:�����*�*�5�1�3�7�����*�*�3�/��5r!c
��dddgffdddgffdddgffddgd�ffddd	gffd
ddgffddd
gffdddgffg}tjj}|D]\}}||�}|j||��!|j	t
|d�|j	t
|d�|j	t
|d�|j	t
|d�y)a
        L{ServerSupportedFeatures._splitParam} splits ISUPPORT parameters
        into key and values. Parameters without a separator are split into a
        key and a list containing only the empty string. Escaped parameters
        are unescaped.
        �FOOr&zFOO=zFOO=1�1z	FOO=1,2,3)r��2�3z
FOO=A\x20BzA Bz	FOO=\x5Cxz\xzFOO=\�\zFOO=\nz\nzFOO=\xzFOO=\xNNzFOO=\xNz
FOO=\x20\xN)r	�ServerSupportedFeatures�_splitParamrr(�
ValueError)r�paramsr��param�expectedr�s      r�test_splitParamz+ServerSupportedFeatureTests.test_splitParam3s���U�R�D�M�"�
�e�b�T�]�#�
�u�s�e�n�%�
�5�/�2�3�
�U�U�G�,�-�
�E�E�7�+�,�
���v��'�
����(�)�	
���1�1�=�=��%�	,�O�E�8��e�$�C����S�(�+�	,�	
���*�k�9�=����*�k�;�?����*�k�:�>����*�k�>�Br!c�n�tjjgd��}|j|gd��y)z�
        L{ServerSupportedFeatures._splitParamArgs} splits ISUPPORT parameter
        arguments into key and value.  Arguments without a separator are
        split into a key and an empty string.
        )�A:1�B:2zC:�D))r|r�)�Br�)�Cr&)r�r&N)r	r��_splitParamArgsr�rr�s  r�test_splitParamArgsz/ServerSupportedFeatureTests.test_splitParamArgsPs,���)�)�9�9�:S�T������L�Mr!c��tjjgd�tj�}|j	|gd��y)z�
        L{ServerSupportedFeatures._splitParamArgs} uses the argument processor
        passed to convert ISUPPORT argument values to some more suitable
        form.
        )r�r�r�))r|ra)r�rb)r�NN)r	r�r�r�rr�s  r�test_splitParamArgsProcessorz8ServerSupportedFeatureTests.test_splitParamArgsProcessorYs8���)�)�9�9���!2�!2�
��	
����?�@r!c���tjj}|j|d�d�|j	t
|d�|j|d�ddd��y)a 
        L{ServerSupportedFeatures._parsePrefixParam} parses the ISUPPORT PREFIX
        parameter into a mapping from modes to prefix symbols, returns
        L{None} if there is no parseable prefix parameter or raises
        C{ValueError} if the prefix parameter is malformed.
        r&Nr�z(ov)@+��@r)r.ra)�o�v)r	r��_parsePrefixParamrr(r�)rrs  r�test_parsePrefixParamz1ServerSupportedFeatureTests.test_parsePrefixParamdsZ�� �7�7�I�I�����*�2�.��5����*�&7��A����*�8�4�H�8�6T�Ur!c�$�tjj}|j|gd��ddddd��|j|gd��ddddd��|j|gd	��ddddd��|j	t
|gd
��y)aO
        L{ServerSupportedFeatures._parseChanModesParam} parses the ISUPPORT
        CHANMODES parameter into a mapping from mode categories to mode
        characters. Passing fewer than 4 parameters results in the empty string
        for the relevant categories. Passing more than 4 parameters raises
        C{ValueError}.
        )r&r&r&r&r&��addressModesr��setParam�noParam)rrXrY�imnpstrrXrYr)rrXrYr&)r�r�c�d�eN)r	r��_parseChanModesParamrr(r�)rrs  r�test_parseChanModesParamz4ServerSupportedFeatureTests.test_parseChanModesParamps��� #�:�:�O�O����� �!1�2��"�"��L�	
�
	
��� �!:�;� �3�C�H�U�	
�
	
��� �!4�5� �3�C�B�O�	
�
	
���*�&:�<U�Vr!c�h�tj�}|jgd��|j|j	d�d�|j|j	d�ddg�|j|j	d�d�|j|j	d	�d
�|j|j	d�d�|j|j
d��|jd
g�|j|j
d��|jd
g�y)a
        L{ServerSupportedFeatures.parse} changes the internal state of the
        instance to reflect the features indicated by the parsed ISUPPORT
        parameters, including unknown parameters and unsetting previously set
        parameters.
        )�MODES=4zCHANLIMIT=#:20,&:10�INVEXz	EXCEPTS=Zz
UNKNOWN=A,B,C�MODESrd�	CHANLIMIT)�#�)�&�
r�I�EXCEPTS�Z�UNKNOWN)r|r�r�z-INVEXN)r	r��parser�
getFeature�
assertTrue�
hasFeature�assertFalse)r�	supporteds  r�
test_parsez&ServerSupportedFeatureTests.test_parse�s����/�/�1�	����U�	
�	
����-�-�g�6��:�����-�-�k�:�Y�	�<R�S�����-�-�g�6��<�����-�-�i�8�#�>�����-�-�i�8�/�J����	�,�,�W�5�6�����
�#�����-�-�g�6�7�����
�#r!c	��tj�}|D��cgc]\}}dj||xsd���}}}|j|�|Scc}}w)z�
        Parse all specified features according to the ISUPPORT specifications.

        @type features: C{list} of C{(featureName, value)}
        @param features: Feature names and values to parse

        @rtype: L{irc.ServerSupportedFeatures}
        z{}={}r&)r	r��formatr")r�featuresr'r��values     r�_parsez"ServerSupportedFeatureTests._parse�sP���/�/�1�	�IQ�R�+�$��G�N�N�4���"�5�R��R�����!����Ss� ANc�L�|j||fg�}|j|�S)z�
        Parse a feature, with the given name and value, according to the
        ISUPPORT specifications and return the parsed value.
        )r-r#)rr�r,r's    r�
_parseFeaturez)ServerSupportedFeatureTests._parseFeature�s)��
�K�K�$����0�	��#�#�D�)�)r!c���|j|j|d�|�|j|j|d�|�|j|j|d�d�y)zW
        Perform some common tests on a feature known to use L{_intOrDefault}.
        N�notanintrT�*�rr/)rr��defaults   r�_testIntOrDefaultFeaturez4ServerSupportedFeatureTests._testIntOrDefaultFeature�s[��	
����+�+�D�$�7��A�����+�+�D�*�=�w�G�����+�+�D�$�7��<r!c���tj�j|}|�dg}|j|�}|j	|j|��|j
|j|�|�y)z�
        Features known to have default values are reported as being present by
        L{irc.ServerSupportedFeatures.hasFeature}, and their value defaults
        correctly, when they don't appear in an ISUPPORT message.
        N)�DEFINITELY_NOT�	a_feature)r	r��	_featuresr-r$r%rr#)rr�r+r4r's     r�_testFeatureDefaultz/ServerSupportedFeatureTests._testFeatureDefault�sk���-�-�/�9�9�$�?����7�8�H��K�K��)�	����	�,�,�T�2�3�����-�-�d�3�W�=r!c�\�|jd�|jddg�|jddg�|j|jdd�ddddd��|j|jdd�ddddd��|j|jdd	�dd
ddd��y
)z�
        The CHANMODES ISUPPORT parameter is parsed into a C{dict} giving the
        four mode categories, C{'addressModes'}, C{'param'}, C{'setParam'}, and
        C{'noParam'}.
        �	CHANMODES)r<zb,,lk,)r<zb,,lk,ha,haz,,,r&rz,A,,r|z
A,Bc,Def,Ghij�Bc�Def�GhijN�r:rr/r+s r�test_support_CHANMODESz2ServerSupportedFeatureTests.test_support_CHANMODES�s���	
� � ��-�� � ��/F�.G�H�� � ��/K�.L�M�������{�E�2��"�"��L�	
�
	
������{�F�3��#�2�"�M�	
�
	
������{�O�<� �4�U�v�V�	
r!c�J�|j|jdd�dg�y)z�
        The IDCHAN support parameter is parsed into a sequence of two-tuples
        giving channel prefix and ID length pairs.
        �IDCHANz!:5)�!�5Nr3r+s r�test_support_IDCHANz/ServerSupportedFeatureTests.test_support_IDCHAN�s#��
	
����+�+�H�e�<�z�l�Kr!c���|j|jdd�ddg�|j|jdd�gd��|j|jdd�gd��y)	z~
        The MAXLIST support parameter is parsed into a sequence of two-tuples
        giving modes and their limits.
        �MAXLISTz
b:25,eI:50�r���eI�2zb:25,eI:50,a:3.1415)rIrK)r�Nzb:25,eI:50,a:notanintNr3r+s r�test_support_MAXLISTz0ServerSupportedFeatureTests.test_support_MAXLIST�sq��
	
������y�,�7�)�Z�9P�	
�	
������y�*?�@�0�	
�	
������y�*A�B�0�	
r!c�H�|j|jdd�d�y)zr
        The NETWORK support parameter is parsed as the network name, as
        specified by the server.
        �NETWORK�IRCNetNr3r+s r�test_support_NETWORKz0ServerSupportedFeatureTests.test_support_NETWORKs!��
	
����+�+�I�x�@�(�Kr!c�F�|j|jd�d�y)z�
        The SAFELIST support parameter is parsed into a boolean indicating
        whether the safe "list" command is supported or not.
        �SAFELISTTNr3r+s r�test_support_SAFELISTz1ServerSupportedFeatureTests.test_support_SAFELISTs��
	
����+�+�J�7��>r!c�H�|j|jdd�d�y)z�
        The STATUSMSG support parameter is parsed into a string of channel
        status that support the exclusive channel notice method.
        �	STATUSMSGz@+Nr3r+s r�test_support_STATUSMSGz2ServerSupportedFeatureTests.test_support_STATUSMSGs!��
	
����+�+�K��>��Er!c���|j|jdd�ddd��|j|jdd�dddd��|j|jdd	�dddd��y)
z�
        The TARGMAX support parameter is parsed into a dictionary, mapping
        strings to integers, of the maximum number of targets for a particular
        command.
        �TARGMAXzPRIVMSG:4,NOTICE:3rdrc)�PRIVMSG�NOTICEzPRIVMSG:4,NOTICE:3,KICK:3.1415N)r[r\�KICKz PRIVMSG:4,NOTICE:3,KICK:notanintr3r+s r�test_support_TARGMAXz0ServerSupportedFeatureTests.test_support_TARGMAXs���	
������y�*>�?��Q�'�	
�
	
������y�*J�K��Q��5�	
�	
������y�*L�M��Q��5�	
r!c�j�tj�jd}|jd|�y)a
        The NICKLEN support parameter is parsed into an integer value
        indicating the maximum length of a nickname the client may use,
        otherwise, if the parameter is missing or invalid, the default value
        (as specified by RFC 1459) is used.
        �NICKLENN�r	r�r9r5�rr4s  r�test_support_NICKLENz0ServerSupportedFeatureTests.test_support_NICKLEN*s-���-�-�/�9�9�)�D���%�%�i��9r!c�j�tj�jd}|jd|�y)z�
        The CHANNELLEN support parameter is parsed into an integer value
        indicating the maximum channel name length, otherwise, if the
        parameter is missing or invalid, the default value (as specified by
        RFC 1459) is used.
        �
CHANNELLENNrarbs  r�test_support_CHANNELLENz3ServerSupportedFeatureTests.test_support_CHANNELLEN4s-���-�-�/�9�9�,�G���%�%�l�G�<r!c�j�|jd�|j|jdd�d�y)zt
        The CHANTYPES support parameter is parsed into a tuple of
        valid channel prefix characters.
        �	CHANTYPESz#&%)rrr3Nr@r+s r�test_support_CHANTYPESz2ServerSupportedFeatureTests.test_support_CHANTYPES>s/��
	
� � ��-�����+�+�K��?��Qr!c�&�|jd�y)z�
        The KICKLEN support parameter is parsed into an integer value
        indicating the maximum length of a kick message a client may use.
        �KICKLENN�r5r+s r�test_support_KICKLENz0ServerSupportedFeatureTests.test_support_KICKLENGs��
	
�%�%�i�0r!c�(�|jd�|jddg�|j|jdd�d�|j|jdd�dddd��|j|jdd	�dddd��y)
z�
        The PREFIX support parameter is parsed into a dictionary mapping
        modes to two-tuples of status symbol and priority.
        �PREFIX)ror�Nz(ohv)@%+r)r3ra)r.rb)r�hrz(hov)@%+r@r+s r�test_support_PREFIXz/ServerSupportedFeatureTests.test_support_PREFIXNs���
	
� � ��*�� � ��,?�+@�A�����+�+�H�d�;�T�B�������x��4����9�	
�	
������x��4����9�	
r!c�&�|jd�y)z�
        The TOPICLEN support parameter is parsed into an integer value
        indicating the maximum length of a topic a client may set.
        �TOPICLENNrlr+s r�test_support_TOPICLENz1ServerSupportedFeatureTests.test_support_TOPICLEN`s��
	
�%�%�j�1r!c�&�|jd�y)a_
        The MODES support parameter is parsed into an integer value
        indicating the maximum number of "variable" modes (defined as being
        modes from C{addressModes}, C{param} or C{setParam} categories for
        the C{CHANMODES} ISUPPORT parameter) which may by set on a channel
        by a single MODE command from a client.
        rNrlr+s r�test_support_MODESz.ServerSupportedFeatureTests.test_support_MODESgs��	
�%�%�g�.r!c��|j|jdd�d�|j|jd�d�y)z�
        The EXCEPTS support parameter is parsed into the mode character
        to be used for "ban exception" modes. If no parameter is specified
        then the character C{e} is assumed.
        rr rNr3r+s r�test_support_EXCEPTSz0ServerSupportedFeatureTests.test_support_EXCEPTSqs<��	
����+�+�I�s�;�S�A�����+�+�I�6��<r!c��|j|jdd�d�|j|jd�d�y)z�
        The INVEX support parameter is parsed into the mode character to be
        used for "invite exception" modes. If no parameter is specified then
        the character C{I} is assumed.
        rr rNr3r+s r�test_support_INVEXz.ServerSupportedFeatureTests.test_support_INVEXzs<��	
����+�+�G�S�9�3�?�����+�+�G�4�c�:r!�N)rrrr]r�r�rrr	rr(r-r/r5r:rArFrNrRrUrXr^rcrfrirmrqrtrvrxrzr r!rr�r�"s����
6�C�:N�	A�
V�W�4$�0�*�=�
>�
�2L�
�$L�?�F�
�(:�=�R�1�
�$2�/�=�;r!r�c��eZdZdZy)�IRCClientWithoutLoginrN)rrr�performLoginr r!rr}r}�s���Lr!r}c�4�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	y)	�	CTCPTestszK
    Tests for L{twisted.words.protocols.irc.IRCClient} CTCP handling.
    c�h�t�|_tj|j�|_t�|_|jj|j�|j|jj�|j|jjd�yr{)r�filer�FileWrapper�	transportr}�client�makeConnection�
addCleanup�loseConnection�connectionLostr+s r�setUpzCTCPTests.setUp�sp��*�,��	�!�-�-�d�i�i�8���+�-������"�"�4�>�>�2�������5�5�6�������2�2�D�9r!c�f�dtjtjtjzd�z}dtjtjtjzd�z}|jj|�|jj�}|j||�y)z�Testing CTCP query ERRMSG.

        Not because this is this is an especially important case in the
        field, but it does go through the entire dispatch/decode/encode
        process.
        z@:nick!guy@over.there PRIVMSG #theChan :%(X)cERRMSG t%(X)c%(EOL)s�r��EOLz>NOTICE nick :%(X)cERRMSG t :No error has occurred.%(X)c%(EOL)sN)	r	�X_DELIMr��LFr��dataReceivedr��getvaluer)r�errQuery�errReply�replys    r�test_ERRMSGzCTCPTests.test_ERRMSG�s���
(�03���C�F�F�S�V�V�O�*T�
U�	�
1��K�K��������8�
9�	�	
��� � ��*��	�	�"�"�$���#�#�E�8�4r!c�L�d|j_|jjddd�dtjtj
tjz|jjd�z}|jj�}|j||�y)z�
        If attributes for version information on L{IRCClient} are set to
        L{None}, the parts of the CTCP VERSION response they correspond to
        are omitted.
        �
FrobozzIRC�nick!guy@over.there�#theChanNz1NOTICE nick :%(X)cVERSION %(vname)s::%(X)c%(EOL)s)r�r��vname)
r��versionName�ctcpQuery_VERSIONr	r�r�r�r�r�r�r�versionReplyr�s   r�test_noNumbersVERSIONzCTCPTests.test_noNumbersVERSION�s~��#/��������%�%�&;�Z��N�M�����6�6�C�F�F�?��[�[�,�,�Q
�
��
�	�	�"�"�$���#�#�E�<�8r!c���d|j_d|j_d|j_|jj	ddd�dt
jt
jt
jz|jj|jj|jjd�z}|jj�}|j||�y)	z�
        The response to a CTCP VERSION query includes the version number and
        environment information, as specified by L{IRCClient.versionNum} and
        L{IRCClient.versionEnv}.
        r�z1.2g�ZorkOSr�r�NzANOTICE nick :%(X)cVERSION %(vname)s:%(vnum)s:%(venv)s%(X)c%(EOL)s)r�r�r��vnum�venv)r�r��
versionNum�
versionEnvr�r	r�r�r�r�r�rr�s   r�test_fullVERSIONzCTCPTests.test_fullVERSION�s���#/�����!'�����!)��������%�%�&;�Z��N�
��[�[��v�v��������0�0����.�.����.�.��
�	��	�	�"�"�$���#�#�E�<�8r!c�D���fd�}d�_|�j_�jjdddj	t
j��g��j�jj�d��j�jd�y	)
zL
        Duplicated CTCP messages are ignored and no reply is made.
        c�0���xjdz
c_y�Nra)�called)�user�channel�datars   �r�testCTCPz8CTCPTests.test_noDuplicateCTCPDispatch.<locals>.testCTCP�s����K�K�1��Kr!r�foo!bar@baz.quux�#chanz{X}TESTTHIS{X}foo{X}TESTTHIS{X}�r�r&raN)r�r��ctcpQuery_TESTTHIS�irc_PRIVMSGr*r	r�rr�r�r)rr�s` r�test_noDuplicateCTCPDispatchz&CTCPTests.test_noDuplicateCTCPDispatch�s����
	����)1����&�������
�7�>�>����>�M�N�	
�	
�#�#�D�I�I�$6�$6�$8�"�=�������a�(r!c�D���fd�}d�_�j�jd|��jjdddj	t
j��g��j�jj�d��j�jd	��j�jd
��jjdddj	t
j��g��j�jd�y
)zQ
        The fallback handler is invoked for unrecognized CTCP messages.
        c�F��||||f�_�xjdz
c_yr�)�
calledWithr�)r�r��tagr�rs    �r�unknownQueryz6CTCPTests.test_noDefaultDispatch.<locals>.unknownQuery�s!���#�W�c�4�8�D�O��K�K�1��Kr!r�ctcpUnknownQueryr�r�z
{X}NOTREAL{X}r�r&)r�r��NOTREALNraz{X}NOTREAL{X}foo{X}NOTREAL{X}rbN)r��patchr�r�r*r	r�rr�r�rr�)rr�s` r�test_noDefaultDispatchz CTCPTests.test_noDefaultDispatch�s����
	�����
�
�4�;�;� 2�L�A��������/�*@�*@�3�;�;�*@�*O� P�	
�	
�#�#�D�I�I�$6�$6�$8�"�=�����O�O�K�	
�	
������a�(�	
������
�5�<�<�s�{�{�<�K�L�	
�	
������a�(r!N)
rrrr]r�r�r�r�r�r�r r!rr�r��s%���:�5�09� 9�0)�$)r!r�c
���eZdZidd�dd�dd�dd�dd�d	d
�dd�d
d�dd�dd�dd�dd�dd�dd�dd�dd�dd�ddd d d!d"d#d$d%��Zd&�Z�fd'�Zd(�Z�xZS))�NoticingClient�created��when�yourHost��info�myInfo��
servername�version�umodes�cmodes�luserClient�bounce�isupport)�options�
luserChannels)�channels�luserOp)�ops�luserMe�receivedMOTD)�motd�privmsg)r�r��message�joined)r��left�noticed�modeChanged)r�r��set�modesr��pong)r��secs�signedOnr )r��kickerr���nick)r�r�)r�r�r�r�)r�r�r�)r�r��newTopic)�oldname�newname)�
kickedFrom�nickChanged�
userJoined�userLeft�
userKicked�action�topicUpdated�userRenamedc��g|_yr{)�calls)rr��kws   r�__init__zNoticingClient.__init__"s����
r!c����|jd�r |jd�rt�|�
|�S	t�|�
d�|}|j	||�S#t
$rt�|�
|�cYSwxYw)N�__�methods)�
startswith�endswith�super�__getattribute__�
makeMethod�KeyError)rr�r��	__class__s   �rr�zNoticingClient.__getattribute__*sw����?�?�4� �T�]�]�4�%8��7�+�D�1�1�	/��7�+�I�6�t�<�D��?�?�4��.�.���	2��7�+�D�1�1�	2�s�A�A3�2A3c��������fd�}|S)Nc���t|�t��kDr#td�t��t|�fz��t�|�D] \}}||vrtd��d|�d���|||<�"t|�t��k7r#td�t��t|�fz���jj	�|f�y)Nz-TypeError: %s() takes %d arguments (%d given)zTypeError: z-() got multiple values for keyword argument '�')�len�	TypeError�zipr��append)r�r�r�r,r��fnamers    ���r�methodz)NoticingClient.makeMethod.<locals>.method5s�����1�v��D�	�!��!�$)�3�t�9�c�!�f�#=�>��� #�4��|�
%���e��2�:�#�7<�d�D���
 %�B�t�H�
%��2�w�#�d�)�#��!�$)�3�t�9�c�!�f�#=�>���
�J�J���u�b�k�*r!r )rrr�rs``` rr�zNoticingClient.makeMethod4s���	+�*�
r!)rrrr�r�r�r��
__classcell__)r�s@rr�r�s�����9���I��	�?��	�y�	�
	�)��	�L�
�	���	�8��	�9��	�	��	�1��	�,��	���	�1��	�B�� 	� �!�"	�B�#�$7� �)�'�>�-�7�-�3�G�8�/�r!r�c�:�	||}||=|S#t$r|cYSwxYwr{)r�)�dict�keyr4r,s    r�poprMs4����S�	��
��I����	�����s���c���eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd d�Zd!d�Zd!d�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z y)"�ClientImplementationTestsc� �t�|_t�|_|jj	|j�|j|jj�|j|jjd�yr{)rr�r�r�r�r�r�r�r+s rr�zClientImplementationTests.setUpXsZ��(�*���$�&������"�"�4�>�>�2�������5�5�6�������2�2�D�9r!c��t|dd�}t|dd�}t|dd�}d|zdz|zdz|zdz|zd	z|zd
z}|jj|�|j|jj||fg�y)N�host�server.hostr��nicknamer�r&�:� � :�
�rr�r�rr�)	r�code�msg�funcr�rr�r�r�s	         r�_serverTestImplz)ClientImplementationTests._serverTestImpl`s����2�v�}�-���2�v�z�*���2�v�r�"��
�$�J���t�#�c�)�D�0�3�6��=��D�s�J�V�S�	�	
��� � ��)�������*�*�d�B�Z�L�9r!c�2�d}|jd|d|��y)NzHYour host is some.host[blah.blah/6667], running version server-version-3�002r�r��r�rrs  r�testYourHostz&ClientImplementationTests.testYourHostls��X�����U�C��#��>r!c�2�d}|jd|d|��y)Nz=This server was cobbled together Fri Aug 13 18:00:25 UTC 2004�003r�r�rrs  r�testCreatedz%ClientImplementationTests.testCreatedps��M�����U�C����=r!c	�8�d}|jd|ddddd��y)	Nz(server.host server-version abcDEF bcdEHI�004r�rzserver-version�abcDEF�bcdEHIr�rrs  r�
testMyInfoz$ClientImplementationTests.testMyInfots/��8��������$�$���	�	
r!c�2�d}|jd|d|��y)Nz4There are 9227 victims and 9542 hiding on 24 servers�251r�r�rrs  r�testLuserClientz)ClientImplementationTests.testLuserClient�s��D�����U�C��S��Ar!c�<�d}d}|jd|d|gd���y)Nz�MODES=4 CHANLIMIT=#:20 NICKLEN=16 USERLEN=10 HOSTLEN=63 TOPICLEN=450 KICKLEN=450 CHANNELLEN=30 KEYLEN=23 CHANTYPES=# PREFIX=(ov)@+ CASEMAPPING=ascii CAPAB IRCD=dancer�are available on this server�005r�)rzCHANLIMIT=#:20z
NICKLEN=16z
USERLEN=10z
HOSTLEN=63zTOPICLEN=450zKICKLEN=450z
CHANNELLEN=30z	KEYLEN=23zCHANTYPES=#z
PREFIX=(ov)@+zCASEMAPPING=ascii�CAPABzIRCD=dancer�r�r�r�rr�rs   r�
_sendISUPPORTz'ClientImplementationTests._sendISUPPORT�s8��
@�	
�
-����������	�	
r!c�$�|j�y)zq
        The client parses ISUPPORT messages sent by the server and calls
        L{IRCClient.isupport}.
        N)r2r+s r�
test_ISUPPORTz'ClientImplementationTests.test_ISUPPORT�s��
	
���r!c�2�d}|jd|d|��y)NzTry server some.host, port 321�010r�r�rrs  r�
testBouncez$ClientImplementationTests.testBounce�s��.�����U�C����<r!c	�J�d}d}|jd|d|t|���y)N�7116zchannels formed�254r�)r�r��r�intr1s   r�testLuserChannelsz+ClientImplementationTests.testLuserChannels�s*���������U�C��t�c�RV�i��Xr!c	�J�d}d}|jd|d|t|���y)N�34zflagged staff members�252r�)r�r�r;r1s   r�testLuserOpz%ClientImplementationTests.testLuserOp�s)����%�����U�C���3�t�9��Mr!c�2�d}|jd|d|��y)Nz!I have 1937 clients and 0 servers�255r�r�rrs  r�testLuserMez%ClientImplementationTests.testLuserMe�s��1�����U�C����=r!c�H�gd�}|D]F}|j|jjg�|jj|dz��H|j|jjddddgifg�|j	|jj
d�y)z�
        Lines received in I{RPL_MOTDSTART} and I{RPL_MOTD} are delivered to
        L{IRCClient.receivedMOTD} when I{RPL_ENDOFMOTD} is received.
        )z9:host.name 375 nickname :- host.name Message of the Day -�/:host.name 372 nickname :- Welcome to host.name�.:host.name 376 nickname :End of /MOTD command.rr�r�zhost.name Message of the Day -�Welcome to host.nameN)rr�r�r��assertIdenticalr��r�lines�Ls   r�test_receivedMOTDz+ClientImplementationTests.test_receivedMOTD�s���

��
�	1�A����T�[�[�.�.��3��K�K�$�$�Q��Z�0�	1�	
����K�K���#��<�2�!���

�
	
�"	
���T�[�[�-�-�t�4r!c��ddg}|D] }|jj|dz��"|j|jjdddgifg�y)z�
        If L{IRCClient} receives I{RPL_MOTD} and I{RPL_ENDOFMOTD} without
        receiving I{RPL_MOTDSTART}, L{IRCClient.receivedMOTD} is still
        called with a list of MOTD lines.
        rFrGrr�r�rHN)r�r�rr�rJs   r�test_withoutMOTDSTARTz/ClientImplementationTests.test_withoutMOTDSTART�sh��
>�<�
��
�	1�A��K�K�$�$�Q��Z�0�	1�	
����K�K����&�;Q�:R�1S� T�U�	
r!c�2�t|dd�}t|dd�}|dz|zdz|z}	d|	zdz|zdz|zdz|zdz}
|jj|
�|j|jj||fg�g|j_y)	N�identrrDrrrrrr)r�sender�group�typerrr�rQr�	wholeUserr�s           r�_clientTestImplz)ClientImplementationTests._clientTestImpl�s����B���)���2�v�v�&���S�L�5�(�3�.��5�	��	�/�C�'�$�.��4�u�<�t�C�c�I�F�R����� � ��)�������*�*�d�B�Z�L�9�����r!c�t�d}|jddd|ddddd|�	�
|jdd
d|ddddd
|�	�
y)NzTooty toot toot.rRz#groupr[r�rQrzsender!ident@host)rQrr�r�r��	recipient)rVrs  r�testPrivmsgz%ClientImplementationTests.testPrivmsg�sk�� ������������$���	�	
�	
����������$���	�	
r!c���tt�jj��\}}�j	|gd���j	|gd���fd�}|d�tt�jj��\}}�j	|gd���j	|gd��|d�tt�jj��\}}�j	|g��j	|g��j��j
�jjjd�d�y)z�
        L{IRCClient.getChannelModeParams} uses ISUPPORT information, either
        given by the server or defaults, to determine which channel modes
        require arguments when being added or removed.
        )rrprXrYrr)rrprrc����d|z}d}�jd|d||g���j�jjj	|�d�g�j_y)Nr/r-r.r�r0)rrIr�r'r#r�)r�rrs  �r�
removeFeaturezJClientImplementationTests.test_getChannelModeParams.<locals>.removeFeature s]�����:�D�0�C�� � ���Z�d�T�F� �S�� � ����!6�!6�!A�!A�$�!G��N� "�D�K�K�r!r<)rprrroN)	�map�sortedr��getChannelModeParamsrr2�assertNotIdenticalr'r#)r�add�remover\s`   r�test_getChannelModeParamsz3ClientImplementationTests.test_getChannelModeParamss
����&�$�+�+�"B�"B�"D�E���V�����<�=�����!5�6�	#�	�k�"��&�$�+�+�"B�"B�"D�E���V�����o�.������1�	�h���&�$�+�+�"B�"B�"D�E���V�����b�!������$�	
���������� 5� 5� @� @�� J�D�Qr!c��tt|jj��\}}|j	|g�|j	|g�y)z�
        L{IRCClient.getUserModeParams} returns a list of user modes (modes that
        the user sets on themself, outside of channel modes) that require
        parameters when added and removed, respectively.
        N)r]r^r��getUserModeParamsr)rrarbs   r�test_getUserModeParamsz0ClientImplementationTests.test_getUserModeParams8sA���&�$�+�+�"?�"?�"A�B���V�����b�!������$r!Nc�Z�|�d}d|�d|�d|�d�}|jj|�y)z@
        Build a MODE string and send it to the client.
        Nr�z:Wolf!~wolf@yok.utu.fi MODE rr)r�r�)rrr��targetr�s     r�_sendModeChangez)ClientImplementationTests._sendModeChangeBs:���>��F�0����#��a��v�T�J����� � ��)r!c����|�d}t|�D]]\}}|\}�|j|d�|j�dd�|j�d|�t�fd�dD��||<�_|S)zO
        Parse the results, do some test and return the data to check.
        r�r�r��Wolf!~wolf@yok.utu.fir�c3�(�K�|]	}�|���y�wr{r )�.0r
r�s  �r�	<genexpr>z=ClientImplementationTests._parseModeChange.<locals>.<genexpr>Ws�����M�S�t�C�y�M�s�)r�r�r�)�	enumerater�tuple)r�resultsrhrE�resultrr�s      @r�_parseModeChangez*ClientImplementationTests._parseModeChangeKs�����>��F�"�7�+�	N�I�A�v�!�L�F�D����V�]�3����T�&�\�+B�C����T�)�_�f�5��M�4L�M�M�G�A�J�	N��r!c��|j|jj|�}|j||�g|j_y)zR
        Compare the expected result with the one returned by the client.
        N)rsr�r�r)rr�rhrrs    r�_checkModeChangez*ClientImplementationTests._checkModeChangeZs<���&�&�t�{�{�'8�'8�&�A�������*�����r!c�J�|jd�|jdg�y)z�
        Mode strings that do not begin with a directional character, C{'+'} or
        C{'-'}, have C{'+'} automatically prepended.
        r:)Tr:r{N�rirur+s r�test_modeMissingDirectionz3ClientImplementationTests.test_modeMissingDirectionbs$��
	
���S�!����3�4�5r!c��|jd�|jdg�|jd�|jdg�y)zx
        No parameters are passed to L{IRCClient.modeChanged} for modes that
        don't take any parameters.
        r;)Fr:r{z+n)TrEr{Nrwr+s r�test_noModeParametersz/ClientImplementationTests.test_noModeParametersjsD��
	
���T�"����4�5�6����T�"����3�4�5r!c��|jdd�|jdg�|jdd�|jdg�y)zk
        Parameters are passed to L{IRCClient.modeChanged} for modes that take
        parameters.
        �+o�a_user)Tr�r}z-o)Frr~Nrwr+s r�test_oneModeParameterz/ClientImplementationTests.test_oneModeParametertsH��
	
���T�8�,����7�8�9����T�8�,����8�9�:r!c��|jdd�|jdg�|jdd�|jddg�y)z�
        Mixing adding and removing modes that do and don't take parameters
        invokes L{IRCClient.modeChanged} with mode characters and parameters
        that match up.
        z+osvza_user another_user)T�osv)r}N�another_userz+v-os)Trr~)F�os)r�NNrwr+s r�test_mixedModesz)ClientImplementationTests.test_mixedModes~sO��	
���V�%:�;����N�O�P����W�&;�<����
%�'L�M�	
r!c��|jdd�|jg�|jtj�}|jt
|�d�|jd|dj��y)z�
        Passing an argument to modes that take no parameters results in
        L{IRCClient.modeChanged} not being called and an error being logged.
        r8r�razToo many parametersrN�	riru�flushLoggedErrorsr	r)rr�assertSubstring�getErrorMessage�r�errorss  r�test_tooManyModeParametersz4ClientImplementationTests.test_tooManyModeParameters�sh��
	
���T�7�+����b�!��'�'����8������V��a�(����2�F�1�I�4M�4M�4O�Pr!c��|jd�|jg�|jtj�}|jt
|�d�|jd|dj��y)z�
        Passing no arguments to modes that do take parameters results in
        L{IRCClient.modeChange} not being called and an error being logged.
        r|razNot enough parametersrNr�r�s  r�test_tooFewModeParametersz3ClientImplementationTests.test_tooFewModeParameters�sf��
	
���T�"����b�!��'�'����8������V��a�(����4�f�Q�i�6O�6O�6Q�Rr!c��|jj}|jd|��|jdg|��d�}|j	|jd|�|jdd|��|jdg|��y	)
z�
        A C{MODE} message whose target is our user (the nickname of our user,
        to be precise), as opposed to a channel, will be parsed according to
        the modes specified by L{IRCClient.getUserModeParams}.
        r|)rh)Trr{c�
�ddgS)Nr r&r r r!rrezBClientImplementationTests.test_userMode.<locals>.getUserModeParams�s����9�r!rez+Z�an_arg)Tr )r�N)r�rrirur�)rrhres   r�
test_userModez'ClientImplementationTests.test_userMode�s������%�%��	
���T�&��1����3�4�V��D�	�	
�
�
�4�;�;� 3�5F�G����T�8�F��;����7�8���Hr!c�����fd�}tj��_�jj�_�j
�jd|��j�jjd��jjdg��j�jjd��j�jjd��j�jj�d��jj!�jj"��j�jj�d��jj%��jj'd��jt)�jj+��d��j�jjd�y)a
        When the I{RPL_WELCOME} message is received a heartbeat is started that
        will send a I{PING} message to the IRC server every
        L{irc.IRCClient.heartbeatInterval} seconds. When the transport is
        closed the heartbeat looping call is stopped too.
        c�J���j�}�j|_|Sr{)�_originalCreateHeartbeat�clock)�	heartbeatrs �r�_createHeartbeatzBClientImplementationTests.test_heartbeat.<locals>._createHeartbeat�s"����5�5�7�I�"�j�j�I�O��r!r�Nr2r&z
PING foo
r)r�Clockr�r�r�r�r�rI�
_heartbeat�irc_RPL_WELCOMEr`r�hostnamerr�r,�advance�heartbeatIntervalr�r�r�getDelayedCalls)rr�s` r�test_heartbeatz(ClientImplementationTests.test_heartbeat�sY���	�
�Z�Z�\��
�(,���(D�(D��%��
�
�4�;�;� 2�4D�E����T�[�[�3�3�T�:����#�#�E�2�.������� 6� 6��=�������-�-�u�5�	
�#�#�D�N�N�$8�$8�$:�B�?��
�
���4�;�;�8�8�9��#�#�D�N�N�$8�$8�$:�N�K�	
���%�%�'����"�"�4�(�����T�Z�Z�7�7�9�:�A�>����T�[�[�3�3�T�:r!c��|j|jjd�d|j_|jj	dg�|j|jjd�y)zo
        If L{irc.IRCClient.heartbeatInterval} is set to L{None} then no
        heartbeat is created.
        Nr2)rIr�r�r�r�r+s r�test_heartbeatDisabledz0ClientImplementationTests.test_heartbeatDisabled�sX��
	
���T�[�[�3�3�T�:�(,����%����#�#�E�2�.����T�[�[�3�3�T�:r!)r&Nr{)!rrrr�rr r#r(r+r2r4r7r=rArDrMrOrVrYrcrfrirsrurxrzrr�r�r�r�r�r�r r!rr
r
Ws���:�
:�?�>�

�B�
�<�=�Y�
N�
>�5�B
�$�
�< R�D%�*�
��6�6�;�
�	Q�	S�I�*;�B;r!r
c��eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�BasicServerFunctionalityTestsc���t�|_tj|j�|_tj�|_|jj|j�yr{)	r�frr�rCr	�IRC�pr�r+s rr�z#BasicServerFunctionalityTests.setUp�sE��'�)����%�%�d�f�f�-��������������d�f�f�%r!c��|jj�}t|t�r|j	d�}|j||�y)z�
        Make sure that the internal buffer equals a specified value.

        @param s: the value to compare against buffer
        @type s: L{bytes} or L{unicode}
        rN)r�r�rrrr)rr:rs   r�checkz#BasicServerFunctionalityTests.check�s>���f�f�o�o�'���a���%�,�,�W�5�K�����a�(r!c�`�|jjddd�|jd�y)z�
        Passing a command and parameters to L{IRC.sendMessage} results in a
        query string that consists of the command and parameters, separated by
        a space, ending with '
'.
        �CMD�param1�param2�CMD param1 param2
N)r��sendMessager�r+s r�test_sendMessagez.BasicServerFunctionalityTests.test_sendMessage�s'��	
�����5�(�H�5��
�
�*�+r!c�^�|jjdd�|jd�y)aF
        Passing a command and parameters to L{IRC.sendCommand} results in a
        query string that consists of the command and parameters, separated by
        a space, ending with '
'.

        The format is described in more detail in
        U{RFC 1459 <https://tools.ietf.org/html/rfc1459.html#section-2.3>}.
        r��r�r�r�N�r��sendCommandr�r+s r�test_sendCommandz.BasicServerFunctionalityTests.test_sendCommand�s&��	
�����5�"6�7��
�
�*�+r!c�^�|jjdd�|jd�y)zk
        Passing unicode parameters to L{IRC.sendCommand} encodes the parameters
        in UTF-8.
        r�)uparam¹uparam²sCMD param¹ param²
Nr�r+s r�test_sendUnicodeCommandz5BasicServerFunctionalityTests.test_sendUnicodeCommand
s&��
	
�����5�"@�A��
�
�9�:r!c��|jt|jjddd�}|j	t|�d�y)zf
        Passing L{None} as the command to L{IRC.sendMessage} raises a
        C{ValueError}.
        Nr�r��IRC message requires a command.�r(r�r�r�rr�r�errors  r�test_sendMessageNoCommandz7BasicServerFunctionalityTests.test_sendMessageNoCommands@��
�!�!�����*�*�D�(�H�
��	
����U��%F�Gr!c��|jt|jjdd�}|j	|j
dd�y)zf
        Passing L{None} as the command to L{IRC.sendCommand} raises a
        C{ValueError}.
        Nr�rr��r(r�r�r�rr�r�s  r�test_sendCommandNoCommandz7BasicServerFunctionalityTests.test_sendCommandNoCommandsC��
�!�!�����*�*�D�2F�
��	
������A��(I�Jr!c��|jt|jjddd�}|j	t|�d�y)zi
        Passing an invalid string command to L{IRC.sendMessage} raises a
        C{ValueError}.
        rr�r�zCSomebody screwed up, 'cuz this doesn't look like a command to me:  Nr�r�s  r�test_sendMessageInvalidCommandz<BasicServerFunctionalityTests.test_sendMessageInvalidCommand&sC��
�!�!�����*�*�C��8�
��	
�����J�T�	
r!c��|jt|jjdd�}|j	|j
dd�y)zi
        Passing an invalid string command to L{IRC.sendCommand} raises a
        C{ValueError}.
        rr�rzInvalid command: " "Nr�r�s  r�test_sendCommandInvalidCommandz<BasicServerFunctionalityTests.test_sendCommandInvalidCommand3sC��
�!�!�����*�*�C�1E�
��	
������A��(>�?r!c�`�|jjddd�|jd�y)z�
        Passing a command and parameters with a specified prefix to
        L{IRC.sendCommand} results in a proper query string including the
        specified line prefix.
        r�r��irc.example.com�$:irc.example.com CMD param1 param2
Nr�r+s r�test_sendCommandWithPrefixz8BasicServerFunctionalityTests.test_sendCommandWithPrefix=s)��	
�����5�"6�8I�J��
�
�<�=r!c�B�dddd�}d}|jjddd|�|jj�}|j	d	d
�\}}|d
dj	d�}|j|d�|jt
|�t
|��y)
aM
        Passing a command and parameters with a specified prefix and tags
        to L{IRC.sendCommand} results in a proper query string including the
        specified line prefix and appropriate tags syntax.  The query string
        should be output as follows:
        @tags :prefix COMMAND param1 param2

        The tags are a string of IRCv3 tags, preceded by '@'.  The rest
        of the string is as described in test_sendMessage.  For more on
        the message tag format, see U{the IRCv3 specification
        <https://ircv3.net/specs/core/message-tags-3.2.html>}.
        �bbbN�eee)�aaa�ccczexample.com/ddd)�aaa=bbbscccsexample.com/ddd=eeer�r�r�� ra�;r��r�r�r�r��splitrr^�r�sendTags�expectedTags�outMsg�	outTagStr�outLine�outTagss       r�test_sendCommandWithTagsz6BasicServerFunctionalityTests.test_sendCommandWithTagsFs���!��%�H��C�������5�"6�8I�8�T������"��#�\�\�$��2��	�7��A�B�-�%�%�d�+������"K�L������-�v�g��?r!c��dddd�}|jt|jjddd|�}|j	|j
dd	�y)
zW
        Passing empty tag names to L{IRC.sendCommand} raises a C{ValueError}.
        r�Nr&)r�r�r&r�r�r�r�A tag name is required.r��rr�r�s   r�!test_sendCommandValidateEmptyTagsz?BasicServerFunctionalityTests.test_sendCommandValidateEmptyTags_sW��!��2�6���!�!���F�F���� ���

��	
������A��(A�Br!c��dddd�}|jt|jjddd|�}|j	|j
dd	�y)
zb
        Passing None as a tag name to L{IRC.sendCommand} raises a
        C{ValueError}.
        r�N�beep)r�r�Nr�r�r�rr�r�r�s   r� test_sendCommandValidateNoneTagsz>BasicServerFunctionalityTests.test_sendCommandValidateNoneTagsnsW��
!��V�<���!�!���F�F���� ���

��	
������A��(A�Br!c��ddi}|jt|jjddd|�}|j	|j
dd�y)	zl
        Passing a tag name containing spaces to L{IRC.sendCommand} raises a
        C{ValueError}.
        zaaa bbbr�r�r�r�r� Tag contains invalid characters.Nr�r�s   r�&test_sendCommandValidateTagsWithSpaceszDBasicServerFunctionalityTests.test_sendCommandValidateTagsWithSpaces~�U��
�u�%���!�!���F�F���� ���

��	
������A��(J�Kr!c��ddi}|jt|jjddd|�}|j	|j
dd�y)	zx
        Passing a tag name containing invalid characters to L{IRC.sendCommand}
        raises a C{ValueError}.
        zaaa_b^@r�r�r�r�rr�Nr�r�s   r�,test_sendCommandValidateTagsWithInvalidCharszJBasicServerFunctionalityTests.test_sendCommandValidateTagsWithInvalidChars�r�r!c��ddd�}d}|jjddd|�|jj�}|j	dd	�\}}|d	d
j	d�}|jt
|�t
|��y
)zr
        Tags with values containing invalid characters passed to
        L{IRC.sendCommand} are escaped.
        r�z
test
 \;;)r�r�)r�sccc=test\r\n\s\\\:\:r�r�r�r�raNr�r�r�s       r�(test_sendCommandValidateTagValueEscapingzFBasicServerFunctionalityTests.test_sendCommandValidateTagValueEscaping�s���
!��9��C�������5�"6�8I�8�T������"��#�\�\�$��2��	�7��A�B�-�%�%�d�+��������&��*>�?r!c�`�|jjddd�|jd�y)N�this-is-sender�
this-is-recipzthis is messagez8:this-is-sender PRIVMSG this-is-recip :this is message
)r�r�r�r+s rrYz)BasicServerFunctionalityTests.testPrivmsg�s%�������'��:K�L��
�
�O�Pr!c�`�|jjddd�|jd�y)Nr�r�zthis is noticez6:this-is-sender NOTICE this-is-recip :this is notice
)r��noticer�r+s r�
testNoticez(BasicServerFunctionalityTests.testNotice��%�����
�
�&��9I�J��
�
�M�Nr!c�`�|jjddd�|jd�y)Nr�r�zthis is actionz6:this-is-sender ACTION this-is-recip :this is action
)r�r�r�r+s r�
testActionz(BasicServerFunctionalityTests.testAction�r�r!c�^�|jjdd�|jd�y)N�this-personz
#this-channelz!:this-person JOIN #this-channel
)r��joinr�r+s r�testJoinz&BasicServerFunctionalityTests.testJoin��!�������M�?�3��
�
�8�9r!c�^�|jjdd�|jd�y)Nr�z
#that-channelz!:this-person PART #that-channel
)r��partr�r+s r�testPartz&BasicServerFunctionalityTests.testPart�r�r!c�2�ttj�dz
�}|jj}d}d}|jj	||dddddd	d
|ddg�gd
�}dj|�t
||||��z}|j|�y)zp
        Verify that a whois by the client receives the right protocol actions
        from the server.
        �dzrequesting-nickztarget-nickrhzhost.comzTarget Userzirc.host.comz
A fake serverF�z
#fakeusersz	#fakemisc)zA:%(hostname)s 311 %(req)s %(targ)s target host.com * :Target Userz>:%(hostname)s 312 %(req)s %(targ)s irc.host.com :A fake serverzN:%(hostname)s 317 %(req)s %(targ)s 12 %(timestamp)s :seconds idle, signon timez8:%(hostname)s 319 %(req)s %(targ)s :#fakeusers #fakemiscz6:%(hostname)s 318 %(req)s %(targ)s :End of WHOIS list.r&r)r��	timestamp�req�targN)r<�timer�r��whoisr�r	r�)rr�r�rrrKr�s       r�	testWhoisz'BasicServerFunctionalityTests.testWhois�s���
��	�	��c�)�*�	��6�6�?�?���������������������
�;�'�	
�
���;�;�u�%�����$�)
�
��	
�
�
�8�r!N)rrrr�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rYr�r�r�r�rr r!rr�r��s|��&�
)�,�
,�;�H�K�
�@�>�@�2
C�C� L� L� @�"Q�O�O�:�:�!r!r�c�.�eZdZdZd�Zd�Zd�Zd�Zd�Zy)�DummyClientz{
    A L{twisted.words.protocols.irc.IRCClient} that stores sent lines in a
    C{list} rather than transmitting them.
    c��g|_yr{)rKr+s rr�zDummyClient.__init__�s	����
r!c�P�tjj|�g|_yr{)r	r
�connectionMaderKr+s rr	zDummyClient.connectionMade�s���
�
�$�$�T�*���
r!c�T�|dtjt|j�z
S)zE
        Truncate an IRC line to the maximum allowed length.
        N)r	�MAX_COMMAND_LENGTHr�	delimiter�r�lines  r�
_truncateLinezDummyClient._truncateLine�s&���B�c�,�,�s�4�>�>�/B�B�C�Cr!c�d�|j|�}tjj||�Sr{)rr	r
�lineReceivedr
s  rrzDummyClient.lineReceived�s)���!�!�$�'���}�}�)�)�$��5�5r!c�X�|jj|j|��yr{)rKrr)r�ms  r�sendLinezDummyClient.sendLine�s���
�
���$�,�,�Q�/�0r!N)	rrrr]r�r	rrrr r!rrr�s!���
��D�6�
1r!rc�"�eZdZdZd�Zd�Zd�Zy)�ClientInviteTestsz(
    Tests for L{IRCClient.invite}.
    c�"�t�|_y)zO
        Create a L{DummyClient} to call C{invite} on in test methods.
        N)rr�r+s rr�zClientInviteTests.setUps
��"�m��r!c��|jjdd�|j|jjdg�y)z�
        If the channel name passed to L{IRCClient.invite} does not begin with a
        channel prefix character, one is prepended to it.
        r2r��INVITE foo #barN�r��inviterrKr+s r�test_channelCorrectionz(ClientInviteTests.test_channelCorrections6��
	
�����5�%�(�������*�*�->�,?�@r!c��|jjdd�|j|jjdg�y)zs
        L{IRCClient.invite} sends an I{INVITE} message with the specified
        username and a channel.
        r2�#barrNrr+s r�test_invitezClientInviteTests.test_invites6��
	
�����5�&�)�������*�*�->�,?�@r!N)rrrr]r�rrr r!rrrs���$�A�Ar!rc��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zdd�Z	dd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�ClientMsgTestszP
    Tests for messages sent with L{twisted.words.protocols.irc.IRCClient}.
    c�V�t�|_|jj�yr{)rr�r	r+s rr�zClientMsgTests.setUp$s��!�m������"�"�$r!c��|jjdd�|j|jjdg�y)zO
        A message containing no newlines is sent in a single command.
        r2r��PRIVMSG foo :barN)r�rrrKr+s r�test_singleLinezClientMsgTests.test_singleLine(s4��	
������u�%�������*�*�-?�,@�Ar!c��|jt|jjddd�|jt|jjddd�y)z�
        Specifying a C{length} value to L{IRCClient.msg} that is too short to
        contain the protocol command to send a message raises C{ValueError}.
        r2r�rrcN)r(r�r�rr+s r�test_invalidMaxLengthz$ClientMsgTests.test_invalidMaxLength/s@��
	
���*�d�k�k�o�o�u�e�Q�G����*�d�k�k�o�o�u�e�Q�Gr!c��td�dzdz}|jjdd|�|j|jjgd��y)z�
        Messages longer than the C{length} parameter to L{IRCClient.msg} will
        be split and sent in multiple commands.
        �
PRIVMSG foo :rcrbr2�barbazbo)r$�PRIVMSG foo :bazzPRIVMSG foo :boN�rr�rrrK)r�
maxLen_msgs  r�test_multipleLine_msgz$ClientMsgTests.test_multipleLine_msg7sJ��
��)�A�-��1�
�������z�:�6�����K�K���G�	
r!c��td�dzdz}|jjdd|�|j|jjgd��y)z�
        Messages longer than the C{length} parameter to L{IRCClient.notice}
        will be split and sent in multiple commands.
        �NOTICE foo :rcrbr2r*)�NOTICE foo :bar�NOTICE foo :bazzNOTICE foo :boN�rr�r�rrK)r�
maxLen_notices  r�test_multipleLine_noticez'ClientMsgTests.test_multipleLine_noticeCsL��
�N�+�a�/�!�3�
������5�*�m�<�����K�K���D�	
r!c�8�d}td|���dz}|jjd||�|j|jjd|��g�g|j_|jjd||dz
�|jdt|jj��g|j_|jjd||dz�|jdt|jj��y)z�
        Messages exactly equal in length to the C{length} parameter to
        L{IRCClient.msg} are sent in a single command.
        r*r)rbr2raNr,�rr�maxLens   r�test_sufficientWidth_msgz'ClientMsgTests.test_sufficientWidth_msgOs���
���}�S�E�*�+�a�/��������s�F�+�������*�*�}�S�E�-B�,C�D������������s�F�Q�J�/�����C���� 1� 1�2�3������������s�F�Q�J�/�����C���� 1� 1�2�3r!c�8�d}td|���dz}|jjd||�|j|jjd|��g�g|j_|jjd||dz
�|jdt|jj��g|j_|jjd||dz�|jdt|jj��y)z�
        Messages exactly equal in length to the C{length} parameter to
        L{IRCClient.notice} are sent in a single command.
        r*r0rbr2raNr3r7s   r�test_sufficientWidth_noticez*ClientMsgTests.test_sufficientWidth_notice_s���
���|�C�5�)�*�Q�.�������5�#�v�.�������*�*�|�C�5�-A�,B�C�����������5�#�v��z�2�����C���� 1� 1�2�3�����������5�#�v��z�2�����C���� 1� 1�2�3r!c��g|j_|jjdd�|j|jjdg�y)zC
        An LF at the beginning of the message is ignored.
        r2�
barr$N�r�rKrrr+s r�test_newlinesAtStart_msgz'ClientMsgTests.test_newlinesAtStart_msgo�@�������������w�'�������*�*�-?�,@�Ar!c��g|j_|jjdd�|j|jjdg�y)zB
        An LF at the beginning of the notice is ignored.
        r2r=r1N�r�rKr�rr+s r�test_newlinesAtStart_noticez*ClientMsgTests.test_newlinesAtStart_noticew�B������������5�'�*�������*�*�->�,?�@r!c��g|j_|jjdd�|j|jjdg�y)z=
        An LF at the end of the message is ignored.
        r2�bar
r$Nr>r+s r�test_newlinesAtEnd_msgz%ClientMsgTests.test_newlinesAtEnd_msgr@r!c��g|j_|jjdd�|j|jjdg�y)z<
        An LF at the end of the notice is ignored.
        r2rFr1NrBr+s r�test_newlinesAtEnd_noticez(ClientMsgTests.test_newlinesAtEnd_notice�rDr!c��g|j_|jjdd�|j|jjddg�y)z;
        An LF within a message causes a new line.
        r2�bar
bazr$r+Nr>r+s r�test_newlinesWithinMessage_msgz-ClientMsgTests.test_newlinesWithinMessage_msg�sC�������������z�*�������*�*�-?�AS�,T�Ur!c��g|j_|jjdd�|j|jjddg�y)z:
        An LF within a notice causes a new line.
        r2rKr1r2NrBr+s r�!test_newlinesWithinMessage_noticez0ClientMsgTests.test_newlinesWithinMessage_notice�sE������������5�*�-�������*�*�->�@Q�,R�Sr!c��g|j_|jjdd�|j|jjddg�y)zH
        Consecutive LFs in messages do not cause a blank line.
        r2�bar

bazr$r+Nr>r+s r�test_consecutiveNewlines_msgz+ClientMsgTests.test_consecutiveNewlines_msg�sC�������������|�,�������*�*�-?�AS�,T�Ur!c��g|j_|jjdd�|j|jjddg�y)zG
        Consecutive LFs in notices do not cause a blank line.
        r2rPr1r2NrBr+s r�test_consecutiveNewlines_noticez.ClientMsgTests.test_consecutiveNewlines_notice�sE������������5�,�/�������*�*�->�@Q�,R�Sr!Nc� ��dj|jj|jj|jj�}|jjd||��g�|j
|jd�fd��|jjD] }|jj||z��"|jt��|�djd��D��}|j||�y)	z�
        Assert that messages sent by L{IRCClient.msg} are split into an
        expected number of commands and the original message is transmitted in
        its entirety over those commands.
        �
:{}!{}@{} r2��lengthr�c�&���j|�Sr{�r)r�r�s �r�<lambda>z?ClientMsgTests.assertLongMessageSplitting_msg.<locals>.<lambda>�s���g�n�n�Q�6G�r!r&c3�(K�|]
\}}}|���y�wr{r �rmr�rhr�s    rrnz@ClientMsgTests.assertLongMessageSplitting_msg.<locals>.<genexpr>�s����!O�.C�d�F�G�'�!O���N)r*r�r�realnamer�rr�rKrrrr�)rr��expectedNumCommandsrW�responsePrefixr�receivedMessager�s       @r�assertLongMessageSplitting_msgz-ClientMsgTests.assertLongMessageSplitting_msg�s����&�,�,��K�K� � ��K�K� � ��K�K� � �
��	
������w�v��6����
�
�4�;�;�	�+G�H��K�K�%�%�	<�D��K�K�$�$�^�d�%:�;�	<�	
����W��':�;��'�'�!O�w�!O�O��	
����/�2r!c� ��dj|jj|jj|jj�}|jjd||��g�|j
|jd�fd��|jjD] }|jj||z��"|jt��|�djd��D��}|j||�y)	z�
        Assert that messages sent by l{IRCClient.notice} are split into an
        expected number of commands and the original message is transmitted in
        its entirety over those commands.
        rUr2rVr�c�&���j|�Sr{rY)r�r�s �rrZzBClientMsgTests.assertLongMessageSplitting_notice.<locals>.<lambda>�s���f�m�m�A�6F�r!r&c3�(K�|]
\}}}|���y�wr{r r\s    rrnzCClientMsgTests.assertLongMessageSplitting_notice.<locals>.<genexpr>�s����!N�.C�d�F�G�'�!N�r]N)r*r�rr^r�r�r�rKrrrr�)rr�r_rWr`rrar�s       @r�!assertLongMessageSplitting_noticez0ClientMsgTests.assertLongMessageSplitting_notice�s����&�,�,��K�K� � ��K�K� � ��K�K� � �
��	
�����5�'�&��9����
�
�4�;�;�	�+F�G��K�K�%�%�	<�D��K�K�$�$�^�d�%:�;�	<�	
����V��&9�:��'�'�!N�v�!N�N��	
����/�2r!c�T�dtjdz
z}|j|d�y)a]
        If a maximum message length is not provided to L{IRCClient.msg} a
        best-guess effort is made to determine a safe maximum,  messages longer
        than this are split into multiple commands with the intent of
        delivering long messages without losing data due to message truncation
        when the server relays them.
        rrbN�r	rrb�rr�s  r�%test_splitLongMessagesWithDefault_msgz4ClientMsgTests.test_splitLongMessagesWithDefault_msg�s)����/�/�!�3�4���+�+�G�Q�7r!c�T�dtjdz
z}|j|d�y)a`
        If a maximum message length is not provided to L{IRCClient.notice} a
        best-guess effort is made to determine a safe maximum,  messages longer
        than this are split into multiple commands with the intent of
        delivering long messages without losing data due to message truncation
        when the server relays them.
        rrbN�r	rrfris  r�(test_splitLongMessagesWithDefault_noticez7ClientMsgTests.test_splitLongMessagesWithDefault_notice�s)����/�/�!�3�4���.�.�w��:r!c�z�dtjdz
z}|j|dtjdz��y)a
        The maximum message length can be specified to L{IRCClient.msg},
        messages longer than this are split into multiple commands with the
        intent of delivering long messages without losing data due to message
        truncation when the server relays them.
        rrbrcrVNrhris  r�&test_splitLongMessagesWithOverride_msgz5ClientMsgTests.test_splitLongMessagesWithOverride_msg�s>����/�/�!�3�4���+�+��Q�s�5�5��:�	,�	
r!c�z�dtjdz
z}|j|dtjdz��y)a
        The maximum message length can be specified to L{IRCClient.notice},
        messages longer than this are split into multiple commands with the
        intent of delivering long messages without losing data due to message
        truncation when the server relays them.
        rrbrcrVNrlris  r�)test_splitLongMessagesWithOverride_noticez8ClientMsgTests.test_splitLongMessagesWithOverride_notices>����/�/�!�3�4���.�.��Q�s�5�5��:�	/�	
r!c���dtjdzz}|jjd|dz|z�|j	|jj
d|zd|zg�y)zK
        IRCClient breaks on newlines before it breaks long lines.
        rrbr2�
r)N�r	rr�rrrK�r�longlines  r�test_newlinesBeforeLineBreakingz.ClientMsgTests.test_newlinesBeforeLineBreakings`���#�0�0�A�5�6��������x�$���9�:�����K�K����(� :�O�h�<V�W�	
r!c���dtjdzz}|jjd|dz|z�|j	|jj
d|zd|zg�y)zK
        IRCClient prefers to break long lines at word boundaries.
        rrbr2rr)Nrtrus  r�test_lineBreakOnWordBoundariesz-ClientMsgTests.test_lineBreakOnWordBoundaries s`���#�0�0�A�5�6��������x�#�~��8�9�����K�K����(� :�O�h�<V�W�	
r!c�2�|jttjdd�|jttjdd�|j	gtjdd��|j	gtjd��y)z�
        L{twisted.words.protocols.irc.split} raises C{ValueError} if given a
        length less than or equal to C{0} and returns C{[]} when splitting
        C{''}.
        r2���rr&raN)r(r�r	r�rr+s r�test_splitSanityzClientMsgTests.test_splitSanity-sg��	
���*�c�i�i���;����*�c�i�i���:�����S�Y�Y�r�1�-�.�����S�Y�Y�r�]�+r!c��tjdd�}|jgd�|�tjdd�}|jgd�|�y)z�
        L{twisted.words.protocols.irc.split} skips any delimiter (space or
        newline) that it finds at the very beginning of the string segment it
        is operating on.  Nothing should be added to the output list because of
        it.
        zxx yyzrb)�xx�yy�zzxx
yyzN)r	r�r)r�rs  r�test_splitDelimitersz#ClientMsgTests.test_splitDelimiters9sF��
�I�I�h��"�����*�A�.��I�I�i��#�����*�A�.r!c��|jttjdd�|jttjdd�y)z�
        L{twisted.words.protocols.irc.split} raises C{ValueError} if given a
        length less than or equal to C{0}.
        r2rr{N)r(r�r	r�r+s r�test_splitValidatesLengthz(ClientMsgTests.test_splitValidatesLengthEs4��
	
���*�c�i�i���:����*�c�i�i���;r!c��|jjdd�|j|jjdg�y)z�
        L{IRCClient.say} prepends the channel prefix C{"#"} if necessary and
        then sends the message to the server for delivery to that channel.
        �
thechannelzthe messagez PRIVMSG #thechannel :the messageN)r��sayrrKr+s r�test_sayzClientMsgTests.test_sayMs4��
	
������m�4�������*�*�-O�,P�Qr!r{)rrrr]r�r%r'r.r5r9r;r?rCrGrIrLrNrQrSrbrfrjrmrorqrwryr|r�r�r�r r!rr!r!s����%�B�H�

�

�4� 4� B�A�B�A�V�T�V�T�3�648�3�8	8�	;�

�

�
�
�
,�
/�<�Rr!r!c�j�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zy)�ClientTestszs
    Tests for the protocol-level behavior of IRCClient methods intended to
    be called by application code.
    c��t�|_t�|_d|j_|jj|j�|j
|jj�d�|j|jj�|j|jjd�y)zT
        Create and connect a new L{IRCClient} to a new L{StringTransport}.
        Fr&N)rr�r
rr~r�rr,r�r�r�r+s rr�zClientTests.setUp\s���)�*���!���
�%*��
�
�"��
�
�$�$�T�^�^�4�	
�#�#�D�N�N�$8�$8�$:�B�?�������5�5�6�����
�
�4�4�d�;r!c��|j�}ttk7r!t|t�r|j	d�}|jd�dS)zF
        Return the last IRC message in the transport buffer.
        rrre)r,�bytesrrrr�)rr�rs   r�getLastLinezClientTests.getLastLinelsB����� ���C�<�J�t�U�3��;�;�w�'�D��z�z�&�!�"�%�%r!c��d}|jj|�d|��dg}|j|jj	�jd�|�y)zU
        L{IRCClient.away} sends an AWAY command with the specified message.
        zSorry, I'm not here.�AWAY :r&�
N)r�awayrr�r,r�)rr�r�s   r�	test_awayzClientTests.test_awayusY��)���
�
���7�#��W�I���
��	
�#�#�D�N�N�$8�$8�$:�$@�$@��$I�8�Tr!c��|jj�ddg}|j|jj	�jd�|�y)zP
        L{IRCClient.back} sends an AWAY command with an empty message.
        r�r&r�N)r�backrr�r,r�)rr�s  r�	test_backzClientTests.test_back�sK��	
�
�
������
��	
�#�#�D�N�N�$8�$8�$:�$@�$@��$I�8�Tr!c��|jjd�|j|jj	�jd�ddg�y)z;
        L{IRCClient.whois} sends a WHOIS message.
        �alicer�zWHOIS alicer&N�rrrr�r,r�r+s r�
test_whoiszClientTests.test_whois�sF��	
�
�
���G�$��#�#��N�N� � �"�(�(��1�M�2�3F�	
r!c��|jjdd�|j|jj	�jd�ddg�y)z�
        L{IRCClient.whois} sends a WHOIS message with a server name if a
        value is passed for the C{server} parameter.
        r�zexample.orgr�zWHOIS example.org alicer&Nr�r+s r�test_whoisWithServerz ClientTests.test_whoisWithServer�sI��
	
�
�
���G�]�3��#�#��N�N� � �"�(�(��1�4M�r�3R�	
r!c	�P�d}d}d}d|j_d|j_|jj|||�d|��d|�d|�d|�d	|jj��d
g}|j	|j
j
�jd�|�y)z�
        L{IRCClient.register} sends NICK and USER commands with the
        username, name, hostname, server name, and real name specified.
        �testuser�testhost�
testserver�testnameN�NICK �USER rrr&r��rr^�password�registerrr�r,r��r�usernamer�r�r�s     r�
test_registerzClientTests.test_register�s���
����!�
�!+��
�
��!%��
�
���
�
���x��:�>��H�:����:�t�}�}�/E�/E�
G��	
��	
�#�#�D�N�N�$8�$8�$:�$@�$@��$I�8�Tr!c
��d}d}d}d|j_d|j_|jj|||�d|jj��d|��d|�d	|�d	|�d
|jj��dg}|j	|j
j
�jd�|�y
)z�
        If the C{password} attribute of L{IRCClient} is not L{None}, the
        C{register} method also sends a PASS command with it as the
        argument.
        r�r�r�r��testpasszPASS r�r�rrr&r�Nr�r�s     r�test_registerWithPasswordz%ClientTests.test_registerWithPassword�s�������!�
�!+��
�
��!+��
�
���
�
���x��:�>��D�M�M�*�*�+�,��H�:����:�t�}�}�/E�/E�
G��
��	
�#�#�D�N�N�$8�$8�$:�$@�$@��$I�8�Tr!c���d}d}d}d|j_d|j_|jj|||�|jj	ddg�|j|j�}|j|d|���|jj	ddg�|j|j�}|j|d	j|d
z��y)z�
        Verify that the client repeats the L{IRCClient.setNick} method with a
        new value when presented with an C{ERR_NICKNAMEINUSE} while trying to
        register.
        r�r�r�r�r�r�r�r��NICK {}r�N)
rr^r�r��irc_ERR_NICKNAMEINUSEr�r�r�rr*)rr�r�r��lastLines     r�test_registerWithTakenNickz&ClientTests.test_registerWithTakenNick�s�������!�
�!+��
�
��!+��
�
���
�
���x��:�>��
�
�+�+�H�w�i�@��#�#�D�N�N�3�����H��h�Z�&8�9�	
�
�
�+�+�H�w�i�@��#�#�D�N�N�3������9�#3�#3�H�t�O�#D�Er!c��d}d�|j_|jj|�|jjddg�|j	|j
�}|j
|dj|dz��y)z�
        L{IRCClient.alterCollidedNick} determines how a nickname is altered upon
        collision while a user is trying to change to that nickname.
        r2c��|dzS)N�***r r�s rrZz<ClientTests.test_overrideAlterCollidedNick.<locals>.<lambda>�s
��t�e�|�r!r�r�r�r�N)r�alterCollidedNickr�r�r�r�rr*)rr�r�s   r�test_overrideAlterCollidedNickz*ClientTests.test_overrideAlterCollidedNick�sp��
��*C��
�
�'��
�
���t�$��
�
�+�+�H�w�i�@��#�#�D�N�N�3������9�#3�#3�D�5�L�#A�Br!c��d}d}|jj|�|jjddg�|jj|�|j	|jj
|�|jj
|�d�|g�|j	|jj
|�y)z�
        When a NICK command is sent after signon, C{IRCClient.nickname} is set
        to the new nickname I{after} the server sends an acknowledgement.
        r2r�r�r�z	!quux@quxN)rr�r��setNickrr�irc_NICK)r�oldnick�newnicks   r�test_nickChangezClientTests.test_nickChange�s���
�����
�
���w�'��
�
�%�%�h��	�:��
�
���g�&�������/�/��9��
�
���'��)�4�w�i�@�������/�/��9r!c���d}|j|jjd�|jj|�|jj	ddg�|j|j�}|j|d|jj���|jjddg�|j|jjd�|jj|jj�|j|jj|jj�|jj}|jj|�|jj	ddg�|j|j�}|j|d|���|j|jj|�y)z�
        Trying to register an illegal nickname results in the default legal
        nickname being set, and trying to change a nickname to an illegal
        nickname results in the old nickname being kept.
        r2Fr�r�r�TN)rr�_registeredr��irc_ERR_ERRONEUSNICKNAMEr�r��erroneousNickFallbackr�r�r)r�badnickr�r�s    r�test_erroneousNickzClientTests.test_erroneousNick�so����������2�2�E�:��
�
���w�'��
�
�.�.�x�'��C��#�#�D�N�N�3������U�4�=�=�+N�+N�*O�#P�Q��
�
�%�%�h��	�:�������2�2�D�9��
�
���d�m�m�A�A�B�������/�/����1T�1T�U��-�-�(�(���
�
���g�&��
�
�.�.�x�'��C��#�#�D�N�N�3������U�7�)�#4�5�������/�/��9r!c��d}d}d}|jj||�|jj||�d|�d|�d�d|�d|�d�dg}|j|jj	�jd�|�y	)
zd
        L{IRCClient.desrcibe} sends a CTCP ACTION message to the target
        specified.
        r2r�waveszPRIVMSG z
 :ACTION �r&r�N)r�describerr�r,r�)rrhr�r�r�s     r�
test_describezClientTests.test_describe	s���
�������
�
���v�v�.��
�
���w��/��v�h�l�6�(�#�6��w�i�|�F�8�3�7��
��
	
�#�#�D�N�N�$8�$8�$:�$@�$@��$I�8�Tr!c�n���fd�}|�j_�jjdddg�y)zh
        The default implementation of L{IRCClient.noticed} doesn't invoke
        C{privmsg()}
        c�(���jd�y)Nz%privmsg() should not have been called)�fail)r�r�r�rs   �rr�z6ClientTests.test_noticedDoesntPrivmsg.<locals>.privmsg(	s����I�I�=�>r!�spamz#greasyspooncafezI don't want any spam!N)rr��
irc_NOTICE)rr�s` r�test_noticedDoesntPrivmsgz%ClientTests.test_noticedDoesntPrivmsg"	s1���	?�!(��
�
���
�
� � ��*<�>V�)W�Xr!c��|jjd�|j|jj	�jd��|jj
�|jjdd�|j|jj	�d�|jj
�i|j_t|jjdz�D];}tj�|z|jjdt|�f<�=|jt|jj�|jjdz�|jjdd�|jt|jj�|jj�|j|jj	�d�y)	z#
        L{IRCClient.ping}
        �	otherusersPRIVMSG otheruser :PINGz
are you theres)PRIVMSG otheruser :PING are you there
rczI sent a lot of pingss1PRIVMSG otheruser :PING I sent a lot of pings
N)r�pingr$r�r,r��clearr�_pings�range�
_MAX_PINGRINGrrr)r�pingNums  r�	test_pingzClientTests.test_ping.	s���
	
�
�
���;�'�����N�N� � �"�-�-�.L�M�	
�	
������	
�
�
���;��8�����N�N� � �"�$X�	
�	
������ "��
�
���T�]�]�8�8�1�<�=�	X�G�BF�)�)�+�PW�BW�D�M�M� � �+��W��!>�?�	X�����T�]�]�1�1�2�D�M�M�4O�4O�RS�4S�T�	
�
�
���;�(?�@�����T�]�]�1�1�2�D�M�M�4O�4O�P�����N�N� � �"�H�	
r!N)rrrr]r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r r!rr�r�VsZ���
<� &�
U�	U�
�
�U�&U�*F�*
C�:�:�6U�"
Y�
r!r�c��eZdZdZd�Zy)�CollectorClientzQ
    A client that saves in a list the names of the methods that got called.
    c�b��g�_d�_|D]}|f�fd�	}t�||���y)zx
        @param methodsList: list of methods' names that should be replaced.
        @type methodsList: C{list}
        �Wolfc������fd�}|S)z6
                Collects C{method}s.
                c�@���jj�|f�yr{)r�r)r�rrs ��r�innerz<CollectorClient.__init__.<locals>.fake_method.<locals>.innerd	s����L�L�'�'����7r!r )rr�rs` �r�fake_methodz-CollectorClient.__init__.<locals>.fake_method_	s���
8��r!N)r�r�setattr)r�methodsListrr�s`   rr�zCollectorClient.__init__U	s:���
�����
�!�	1�F�#)�
�
�D�&�+�-�0�	1r!N)rrrr]r�r r!rr�r�P	s���1r!r�c�^�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zy)�DccTestsz%
    Tests for C{dcc_*} methods.
    c�H�gd�}d|_d|_t|�|_y)N)�	dccDoSend�dccDoAcceptResume�dccDoResume�	dccDoChatrk�#twisted�r�r�r�r��rr�s  rr�zDccTests.setUpq	s!��P��+��	�!���%�g�.��r!c���|jj|j|jd�|j	|jj
d|jddddgd�ffg�y)	zO
        L{irc.IRCClient.dcc_SEND} invokes L{irc.IRCClient.dccDoSend}.
        �foo.txt 127.0.0.1 1025r��	127.0.0.1��foo.txtr{�r�r��1025N)r��dcc_SENDr�r�rr�r+s r�test_dccSendzDccTests.test_dccSendw	sh��	
�����T�Y�Y����6N�O�����K�K��� ��	�	�#��!��8�
�
�
�	
r!c�p�tj�}|jt|jdd�y)zM
        L{irc.IRCClient.dccDoSend} is raises C{NotImplementedError}
        r�N)r	r
r(�NotImplementedError�dccSend)rr�s  r�test_dccSendNotImplementedz#DccTests.test_dccSendNotImplemented�	s(����������-�v�~�~�z�4�Pr!c���|jtj|jj|j
|jd�}|jt|�d�y)z{
        L{irc.IRCClient.dcc_SEND} raises L{irc.IRCBadMessage} when it is passed
        a malformed query string.
        r2z#malformed DCC SEND request: ['foo']N�	r(r	�
IRCBadMessager�r�r�r�rr�rrrs  r�test_dccSendMalformedRequestz%DccTests.test_dccSendMalformedRequest�	�N��
�"�"����t�{�{�3�3�T�Y�Y����e�
��	
����V��&K�Lr!c���|jtj|jj|j
|jd�}|jt|�d�y)z�
        L{irc.IRCClient.dcc_SEND} raises L{irc.IRCBadMessage} when it is passed
        a query string that doesn't contain a valid address.
        zfoo.txt #23 sd@dzIndecipherable address '#23'Nr�r�s  r�!test_dccSendIndecipherableAddressz*DccTests.test_dccSendIndecipherableAddress�	sR��
�"�"�����K�K� � ��I�I��L�L��
��	
����V��&D�Er!c���|jtj|jj|j
|jd�}|jt|�d�y)z�
        L{irc.IRCClient.dcc_SEND} raises L{irc.IRCBadMessage} when it is passed
        a query string that doesn't contain a valid port number.
        �foo.txt 127.0.0.1 sd@d�Indecipherable port 'sd@d'Nr�r�s  r�test_dccSendIndecipherablePortz'DccTests.test_dccSendIndecipherablePort�	�R��
�"�"�����K�K� � ��I�I��L�L�$�
��	
����V��&B�Cr!c���|jj|j|jd�|j	|jj
d|jdddffg�y)zY
        L{irc.IRCClient.dcc_ACCEPT} invokes L{irc.IRCClient.dccDoAcceptResume}.
        �foo.txt 1025 2r�r�r�rbN)r��
dcc_ACCEPTr�r�rr�r+s r�test_dccAcceptzDccTests.test_dccAccept�	sV��	
�����t�y�y�$�,�,�8H�I�����K�K���!�D�I�I�y�$��#B�
C�D�	
r!c���|jtj|jj|j
|jd�}|jt|�d�y)z}
        L{irc.IRCClient.dcc_ACCEPT} raises L{irc.IRCBadMessage} when it is
        passed a malformed query string.
        r2z*malformed DCC SEND ACCEPT request: ['foo']N)	r(r	r�r�rr�r�rrr�s  r�test_dccAcceptMalformedRequestz'DccTests.test_dccAcceptMalformedRequest�	�O��
�"�"����t�{�{�5�5�t�y�y�$�,�,�PU�
��	
����V��&R�Sr!c���|jj|j|jd�|j	|jj
d|jdddffg�y)zS
        L{irc.IRCClient.dcc_RESUME} invokes L{irc.IRCClient.dccDoResume}.
        rr�r�r�rbN)r��
dcc_RESUMEr�r�rr�r+s r�test_dccResumezDccTests.test_dccResume�	sU��	
�����t�y�y�$�,�,�8H�I�����K�K���=�4�9�9�i��q�2Q�"R�!S�	
r!c���|jtj|jj|j
|jd�}|jt|�d�y)z}
        L{irc.IRCClient.dcc_RESUME} raises L{irc.IRCBadMessage} when it is
        passed a malformed query string.
        r2z*malformed DCC SEND RESUME request: ['foo']N)	r(r	r�r�r
r�r�rrr�s  r�test_dccResumeMalformedRequestz'DccTests.test_dccResumeMalformedRequest�	rr!c
���|jj|j|jd�|j	|jj
d|j|jddgd�ffg�y)zO
        L{irc.IRCClient.dcc_CHAT} invokes L{irc.IRCClient.dccDoChat}.
        r�r�r�r�r�N)r��dcc_CHATr�r�rr�r+s r�test_dccChatzDccTests.test_dccChat�	si��	
�����T�Y�Y����6N�O�����K�K��� ��	�	����#��8��	�
�	
r!c���|jtj|jj|j
|jd�}|jt|�d�y)z{
        L{irc.IRCClient.dcc_CHAT} raises L{irc.IRCBadMessage} when it is
        passed a malformed query string.
        r2z#malformed DCC CHAT request: ['foo']N�	r(r	r�r�rr�r�rrr�s  r�test_dccChatMalformedRequestz%DccTests.test_dccChatMalformedRequest�	r�r!c���|jtj|jj|j
|jd�}|jt|�d�y)z�
        L{irc.IRCClient.dcc_CHAT} raises L{irc.IRCBadMessage} when it is passed
        a query string that doesn't contain a valid port number.
        rrNrr�s  r�test_dccChatIndecipherablePortz'DccTests.test_dccChatIndecipherablePort
rr!N)rrrr]r�r�r�r�r�rrr
rrrrrr r!rr�r�l	sP���/�
�,Q�M�F�D�
�T�
�T�
�*M�Dr!r�c�F�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zy)�ServerToClientTestszL
    Tests for the C{irc_*} methods sent from the server to the client.
    c�H�d|_d|_gd�}t|�|_y)Nrkr�)	r�r�r�r��userQuitr�r�r�r�r�r�s  rr�zServerToClientTests.setUp
s%��+��	�!���

��&�g�.��r!c�
�|jj|j|jg�|jjddg�|j	|jj
d|jffdg�y)z�
        L{IRCClient.joined} is called when I join a channel;
        L{IRCClient.userJoined} is called when someone else joins.
        �Svadilfari!~svadi@yok.utu.fi�#pythonr�)r���
SvadilfarirN)r��irc_JOINr�r�rr�r+s r�
test_irc_JOINz!ServerToClientTests.test_irc_JOIN$
sh��
	
�����T�Y�Y�����7������;�i�[�I�����K�K��������
(�*S�T�	
r!c�
�|jj|j|jg�|jjddg�|j	|jj
d|jffdg�y)z�
        L{IRCClient.left} is called when I part the channel;
        L{IRCClient.userLeft} is called when someone else parts.
        rrr�)r�r N)r��irc_PARTr�r�rr�r+s r�
test_irc_PARTz!ServerToClientTests.test_irc_PART0
sh��
	
�����T�Y�Y�����7������;�i�[�I�����K�K����t�|�|�o�
&�(O�P�	
r!c���|jjddg�|jj|jdg�|j|jjddg�y)zo
        L{IRCClient.userQuit} is called whenever someone quits
        the channel (myself included).
        r�Adios.�	Farewell.)r)r!r()r)r�r)N)r��irc_QUITr�rr�r+s r�
test_irc_QUITz!ServerToClientTests.test_irc_QUIT<
s[��
	
�����;�h�Z�H������T�Y�Y��
�6�����K�K���6�3�
�	
r!c�>�dtjtjtjzd�z}|jj|j|j|g�|j|jjd|jddffg�y)zK
        L{IRCClient.noticed} is called when a notice is received.
        z:%(X)cextended%(X)cdata1%(X)cextended%(X)cdata2%(X)c%(EOL)sr�r�r�zdata1 data2N)
r	r�r�r�r�r�r�r�rr�rs  r�test_irc_NOTICEz#ServerToClientTests.test_irc_NOTICEK
s~��K�����6�6�C�F�F�?�N
�
��	
�����t�y�y�4�<�<��*=�>�����K�K���9�t�y�y�*�m�.T�"U�!V�	
r!c	��|jjdgd��|jj|j|jddg�|j	|jj
ddd|jddffg�y)	z�
        L{IRCClient.kickedFrom} is called when I get kicked from the channel;
        L{IRCClient.userKicked} is called when someone else gets kicked.
        r)r�WOLF�
shoryuken!r!z	hadouken!)r�)rr!r0r�r�N)r��irc_KICKr�r�rr�r+s r�
test_irc_KICKz!ServerToClientTests.test_irc_KICKX
sy��	
�����*�,M�	
�	
�����T�Y�Y����|�[�(Q�R�����K�K���G���d�l�l�F�K�P�Q�
�	
r!c���|jj|j|jdg�|j	|jj
dd|jdffg�y)zR
        L{IRCClient.topicUpdated} is called when someone sets the topic.
        �new topic is newr�r�N)r��	irc_TOPICr�r�rr�r+s r�test_irc_TOPICz"ServerToClientTests.test_irc_TOPICj
sX��	
�����d�i�i�$�,�,�8J�)K�L�����K�K����v�t�|�|�5G�H�
I�J�	
r!c���|jj|jd|jdg�|j	|jj
dd|jdffg�y)zc
        L{IRCClient.topicUpdated} is called when the topic is initially
        reported.
        �?r4r�r�N)r��
irc_RPL_TOPICr�r�rr�r+s r�test_irc_RPL_TOPICz&ServerToClientTests.test_irc_RPL_TOPICt
sZ��
	
���!�!�$�)�)�c�4�<�<�AS�-T�U�����K�K����v�t�|�|�5G�H�
I�J�	
r!c���|jj|jd|jg�|j	|jj
dd|jdffg�y)zP
        L{IRCClient.topicUpdated} is called when the topic is removed.
        r8r�r�r&N)r��irc_RPL_NOTOPICr�r�rr�r+s r�test_irc_RPL_NOTOPICz(ServerToClientTests.test_irc_RPL_NOTOPIC
sU��	
���#�#�D�I�I��T�\�\�/B�C�����K�K���>�F�D�L�L�"�3M�"N�!O�	
r!N)
rrrr]r�r#r&r+r-r2r6r:r=r r!rrr
s4���/� 

�

�

�
�
�$
�	
�
r!rc�@�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zy
)�CTCPQueryTestsz/
    Tests for the C{ctcpQuery_*} methods.
    c�B�d|_d|_tdg�|_y)Nrkr��
ctcpMakeReplyr�r+s rr�zCTCPQueryTests.setUp�
s��+��	�!���%��&7�8��r!c��|jj|j|jd�|j	|jj
dddgffg�y)zm
        L{IRCClient.ctcpQuery_PING} calls L{IRCClient.ctcpMakeReply} with the
        correct args.
        r�rAr�)�PINGr�N)r��ctcpQuery_PINGr�r�rr�r+s r�test_ctcpQuery_PINGz"CTCPQueryTests.test_ctcpQuery_PING�
sP��
	
���"�"�4�9�9�d�l�l�F�C�����K�K���?�V�>N�=O�4P�"Q�!R�	
r!c���d|j_|jj|j|jd�|j|jjdddgffg�y)zo
        L{IRCClient.ctcpQuery_FINGER} calls L{IRCClient.ctcpMakeReply} with the
        correct args.
        r�r�rAr�)�FINGERr�N)r��fingerReply�ctcpQuery_FINGERr�r�rr�r+s r�test_ctcpQuery_FINGERz$CTCPQueryTests.test_ctcpQuery_FINGER�
s\��
#*��������$�$�T�Y�Y����f�E�����K�K���?�V�>Q�=R�4S�"T�!U�	
r!c���d|j_|jj|j|jd�|j|jjddddgffg�y)zo
        L{IRCClient.ctcpQuery_SOURCE} calls L{IRCClient.ctcpMakeReply} with the
        correct args.
        �urlr�rAr�)�SOURCErL)rMNN)r��	sourceURL�ctcpQuery_SOURCEr�r�rr�r+s r�test_ctcpQuery_SOURCEz$CTCPQueryTests.test_ctcpQuery_SOURCE�
s`��
!&��������$�$�T�Y�Y����f�E�����K�K�����):�<L�(M�N�
O�P�	
r!c���d|j_|jj|j|jd�|j|jjdddgffg�y)zq
        L{IRCClient.ctcpQuery_USERINFO} calls L{IRCClient.ctcpMakeReply} with
        the correct args.
        r�r�rAr�)�USERINFOr�N)r��userinfo�ctcpQuery_USERINFOr�r�rr�r+s r�test_ctcpQuery_USERINFOz&CTCPQueryTests.test_ctcpQuery_USERINFO�
s\��
 &��������&�&�t�y�y�$�,�,��G�����K�K���?�V�>R�=S�4T�"U�!V�	
r!c�4�|jj|j|jd�|jj|j|jd�d}|j	|jj
ddd|fgffdddgffg�y)	zs
        L{IRCClient.ctcpQuery_CLIENTINFO} calls L{IRCClient.ctcpMakeReply} with
        the correct args.
        r&z	PING PONGzEACTION CLIENTINFO DCC ERRMSG FINGER PING SOURCE TIME USERINFO VERSIONrAr��
CLIENTINFO)rWNN)r��ctcpQuery_CLIENTINFOr�r�rr�)rr�s  r�test_ctcpQuery_CLIENTINFOz(CTCPQueryTests.test_ctcpQuery_CLIENTINFO�
s���
	
���(�(����D�L�L�"�E����(�(����D�L�L�+�N�V�	
�	
����K�K��� �6�\�4�,@�+A�"B�C� �6�,@�+A�"B�C�
�	
r!c���|jj|j|jd�|j	|jj
dddd�y)zm
        L{IRCClient.ctcpQuery_TIME} calls L{IRCClient.ctcpMakeReply} with the
        correct args.
        r�rrar�N)r��ctcpQuery_TIMEr�r�rr�r+s r�test_ctcpQuery_TIMEz"CTCPQueryTests.test_ctcpQuery_TIME�
sK��
	
���"�"�4�9�9�d�l�l�F�C�������,�,�Q�/��2�1�5�v�>r!c��|jj|j|jd�|j	|jj
dddgffg�y)zl
        L{IRCClient.ctcpQuery_DCC} calls L{IRCClient.ctcpMakeReply} with the
        correct args.
        r�rAr�)�ERRMSGz!DCC data :Unknown DCC type 'DATA'N)r��
ctcpQuery_DCCr�r�rr�r+s r�test_ctcpQuery_DCCz!CTCPQueryTests.test_ctcpQuery_DCC�
sX��
	
���!�!�$�)�)�T�\�\�6�B�����K�K���$��M�N�O��
�	
r!N)rrrr]r�rErJrPrUrYr\r`r r!rr?r?�
s/���9�

�	
�

�	
�
�$?�
r!r?c��eZdZdZd�Zy)�DccChatFactoryTestsz&
    Tests for L{DccChatFactory}.
    c���d}tjd|�}|jd�}|j|tj�|j|j|�y)z�
        An instance of the L{irc.DccChat} protocol is returned, which has the
        factory property set to the factory which created it.
        )�fromUserNNNr�)r	�DccChatFactory�
buildProtocol�assertIsInstance�DccChatr�factory)r�	queryDatarirs    r�test_buildProtocolz&DccChatFactoryTests.test_buildProtocol�
sU��
-�	��$�$�T�9�5���(�(��5�����h����4�����)�)�7�3r!N)rrrr]rkr r!rrbrb�
s���	4r!rbc��eZdZdZd�Zy)�DccDescribeTestsz#
    Tests for L{dccDescribe}.
    c�R�tjd�}|j|d�y)z@
        L{irc.dccDescribe} supports long IP addresses.
        zCHAT arg 3232235522 6666z$CHAT for host 192.168.0.2, port 6666N)r	�dccDescriberr�s  r�test_addresszDccDescribeTests.test_addresss$�����!;�<������!G�Hr!N)rrrr]rpr r!rrmrm�
s
���Ir!rmc�H�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zd�Zy)
�DccFileReceiveTestsz&
    Tests for L{DccFileReceive}.
    Nc��tj||��}|r|jd�t�}|j|�|S)a�
        Factory helper that returns a L{DccFileReceive} instance
        for a specific test case.

        @param filename: Path to the local file where received data is stored.
        @type filename: L{str}

        @param resumeOffset: An integer representing the amount of bytes from
            where the transfer of data should be resumed.
        @type resumeOffset: L{int}

        @param overwrite: A boolean specifying whether the file to write to
            should be overwritten by calling L{DccFileReceive.set_overwrite}
            or not.
        @type overwrite: L{bool}

        @return: An instance of L{DccFileReceive}.
        @rtype: L{DccFileReceive}
        ��resumeOffsetT)r	�DccFileReceive�
set_overwriterr�)r�filenameru�	overwriterr�s      r�makeConnectedDccFileReceivez/DccFileReceiveTests.makeConnectedDccFileReceive
sF��(�%�%�h�\�J���"�H�"�"�4�(�#�%�	�����	�*��r!c�L�|j|�|jd�y)z�
        Arrange the protocol so that it received all data.

        @param protocol: The protocol which will receive the data.
        @type: L{DccFileReceive}

        @param data: The received data.
        @type data: L{bytest}
        N)r�r�)rrr�s   r�allDataReceivedForProtocolz.DccFileReceiveTests.allDataReceivedForProtocol(s$��	����d�#������%r!c��t|j��}|jd�|j|jd��}|j|d�|j
|j�d�y)z�
        If given a resumeOffset argument, L{DccFileReceive} will attempt to
        resume from that number of bytes if the file exists.
        sTwisted is awesome!�rtsamazing!�Twisted is amazing!N�r�mktemp�
setContentrz�pathr|r�
getContent�r�fprs   r�test_resumeFromResumeOffsetz/DccFileReceiveTests.test_resumeFromResumeOffset5sa��
�d�k�k�m�
$��
�
�
�,�-��3�3�B�G�G�"�3�M���'�'��+�>��������*@�Ar!c��t|j��}|jd�|j|jd��}|j|d�|j
|j�d�y)aG
        When resuming from an offset somewhere in the middle of the file,
        for example, if there are 50 bytes in a file, and L{DccFileReceive}
        is given a resumeOffset of 25, and after that 15 more bytes are
        written to the file, then the resultant file should have just 40
        bytes of data.
        rr~rtscool!sTwisted is cool!Nr�r�s   r�:test_resumeFromResumeOffsetInTheMiddleOfAlreadyWrittenDatazNDccFileReceiveTests.test_resumeFromResumeOffsetInTheMiddleOfAlreadyWrittenDataBsa���d�k�k�m�
$��
�
�
�,�-��3�3�B�G�G�"�3�M���'�'��(�;��������*=�>r!c��t|j��}|jd�|j|jd��}|j|d�|j
|j�d�y)z�
        When local file already exists it can be overwritten using the
        L{DccFileReceive.set_overwrite} method.
        sI love contributing to Twisted!T)rysTwisted rocks!Nr�r�s   r�test_setOverwritez%DccFileReceiveTests.test_setOverwriteRsb��
�d�k�k�m�
$��
�
�
�8�9��3�3�B�G�G�t�3�L���'�'��2C�D��������*;�<r!c���t|j��}|j|j�}|j	|d�|j|j
�d�y)z~
        If the file does not already exist, then L{DccFileReceive} will
        create one and write the data to it.
        sI <3 TwistedN)rr�rzr�r|rr�r�s   r�test_fileDoesNotExistz)DccFileReceiveTests.test_fileDoesNotExist_sN��
�d�k�k�m�
$���3�3�B�G�G�<���'�'��/�B��������/�:r!c���t|j��}|jt|j|j
d��}|j
tj|j�y)z�
        If given a resumeOffset to resume writing to a file that does not
        exist, L{DccFileReceive} will raise L{OSError}.
        rartN)	rr�r(�OSErrorrzr�r�errno�ENOENT)rr�r�s   r�test_resumeWhenFileDoesNotExistz3DccFileReceiveTests.test_resumeWhenFileDoesNotExistksV��
�d�k�k�m�
$���!�!��T�5�5�r�w�w�Q�"�
��	
������u�{�{�3r!c��t|j��}|j�|jt|j
|j�y)zn
        If the file already exists and overwrite action was not asked,
        L{OSError} is raised.
        N)rr��touchr(r�rzr��rr�s  r�!test_fileAlreadyExistsNoOverwritez5DccFileReceiveTests.test_fileAlreadyExistsNoOverwritexs9��
�d�k�k�m�
$��
���
����'�4�#C�#C�R�W�W�Mr!c��t|j��jd�}|jt|j
|j�y)zO
        L{IOError} is raised when failing to open the requested path.
        zchild-with-no-existing-parentN)rr��childr(�IOErrorrzr�r�s  r�test_failToOpenLocalFilez,DccFileReceiveTests.test_failToOpenLocalFile�s<���d�k�k�m�
$�
*�
*�+J�
K�����'�4�#C�#C�R�W�W�Mr!)rN)
rrrr]rzr|r�r�r�r�r�r�r�r r!rrrrrs7����6&�B�?� =�
;�4�N�Nr!rr)6r]r�rkr�twisted.internetrr�twisted.internet.testingrr�twisted.python.filepathr�twisted.trial.unittestr�twisted.words.protocolsr	�twisted.words.protocols.ircr
rr|r
r#r_ror�r*r�r�r��X_QUOTE�M_QUOTEr�r��_CommandDispatcherMixinr�r�r�r}r�r�rr
r�rrr!r�r�r�rr?rbrmrrr r!r�<module>r�s����
���+�L�,�+�'�B�+�(�+�*M&�{�M&�`
��
�,\
��\
�~"
�K�"
�L:�'�.�.�3�7�7�.�;�(�/�/�3�6�6�c�f�f�/�E�2��K�K�c�k�k�*�+�	��
C�;�
C� ��,�,��(F�k�F�D_;�+�_;�D�C�M�M��z)��z)�zE�*�E�P�H;��H;�VB�K�B�J1�#�-�-�1�8A��A�8tR�[�tR�n	w
�+�w
�t1�c�m�m�1�8`D�{�`D�Fw
�+�w
�t^
�[�^
�B4�+�4�"
I�{�
I�@N�+�@Nr!
¿Qué es la limpieza dental de perros? - Clínica veterinaria


Es la eliminación del sarro y la placa adherida a la superficie de los dientes mediante un equipo de ultrasonidos que garantiza la integridad de las piezas dentales a la vez que elimina en profundidad cualquier resto de suciedad.

A continuación se procede al pulido de los dientes mediante una fresa especial que elimina la placa bacteriana y devuelve a los dientes el aspecto sano que deben tener.

Una vez terminado todo el proceso, se mantiene al perro en observación hasta que se despierta de la anestesia, bajo la atenta supervisión de un veterinario.

¿Cada cuánto tiempo tengo que hacerle una limpieza dental a mi perro?

A partir de cierta edad, los perros pueden necesitar una limpieza dental anual o bianual. Depende de cada caso. En líneas generales, puede decirse que los perros de razas pequeñas suelen acumular más sarro y suelen necesitar una atención mayor en cuanto a higiene dental.


Riesgos de una mala higiene


Los riesgos más evidentes de una mala higiene dental en los perros son los siguientes:

  • Cuando la acumulación de sarro no se trata, se puede producir una inflamación y retracción de las encías que puede descalzar el diente y provocar caídas.
  • Mal aliento (halitosis).
  • Sarro perros
  • Puede ir a más
  • Las bacterias de la placa pueden trasladarse a través del torrente circulatorio a órganos vitales como el corazón ocasionando problemas de endocarditis en las válvulas. Las bacterias pueden incluso acantonarse en huesos (La osteomielitis es la infección ósea, tanto cortical como medular) provocando mucho dolor y una artritis séptica).

¿Cómo se forma el sarro?

El sarro es la calcificación de la placa dental. Los restos de alimentos, junto con las bacterias presentes en la boca, van a formar la placa bacteriana o placa dental. Si la placa no se retira, al mezclarse con la saliva y los minerales presentes en ella, reaccionará formando una costra. La placa se calcifica y se forma el sarro.

El sarro, cuando se forma, es de color blanquecino pero a medida que pasa el tiempo se va poniendo amarillo y luego marrón.

Síntomas de una pobre higiene dental
La señal más obvia de una mala salud dental canina es el mal aliento.

Sin embargo, a veces no es tan fácil de detectar
Y hay perros que no se dejan abrir la boca por su dueño. Por ejemplo…

Recientemente nos trajeron a la clínica a un perro que parpadeaba de un ojo y decía su dueño que le picaba un lado de la cara. Tenía molestias y dificultad para comer, lo que había llevado a sus dueños a comprarle comida blanda (que suele ser un poco más cara y llevar más contenido en grasa) durante medio año. Después de una exploración oftalmológica, nos dimos cuenta de que el ojo tenía una úlcera en la córnea probablemente de rascarse . Además, el canto lateral del ojo estaba inflamado. Tenía lo que en humanos llamamos flemón pero como era un perro de pelo largo, no se le notaba a simple vista. Al abrirle la boca nos llamó la atención el ver una muela llena de sarro. Le realizamos una radiografía y encontramos una fístula que llegaba hasta la parte inferior del ojo.

Le tuvimos que extraer la muela. Tras esto, el ojo se curó completamente con unos colirios y una lentilla protectora de úlcera. Afortunadamente, la úlcera no profundizó y no perforó el ojo. Ahora el perro come perfectamente a pesar de haber perdido una muela.

¿Cómo mantener la higiene dental de tu perro?
Hay varias maneras de prevenir problemas derivados de la salud dental de tu perro.

Limpiezas de dientes en casa
Es recomendable limpiar los dientes de tu perro semanal o diariamente si se puede. Existe una gran variedad de productos que se pueden utilizar:

Pastas de dientes.
Cepillos de dientes o dedales para el dedo índice, que hacen más fácil la limpieza.
Colutorios para echar en agua de bebida o directamente sobre el diente en líquido o en spray.

En la Clínica Tus Veterinarios enseñamos a nuestros clientes a tomar el hábito de limpiar los dientes de sus perros desde que son cachorros. Esto responde a nuestro compromiso con la prevención de enfermedades caninas.

Hoy en día tenemos muchos clientes que limpian los dientes todos los días a su mascota, y como resultado, se ahorran el dinero de hacer limpiezas dentales profesionales y consiguen una mejor salud de su perro.


Limpiezas dentales profesionales de perros y gatos

Recomendamos hacer una limpieza dental especializada anualmente. La realizamos con un aparato de ultrasonidos que utiliza agua para quitar el sarro. Después, procedemos a pulir los dientes con un cepillo de alta velocidad y una pasta especial. Hacemos esto para proteger el esmalte.

La frecuencia de limpiezas dentales necesaria varía mucho entre razas. En general, las razas grandes tienen buena calidad de esmalte, por lo que no necesitan hacerlo tan a menudo e incluso pueden pasarse la vida sin requerir una limpieza. Sin embargo, razas pequeñas como el Yorkshire o el Maltés, deben hacérselas todos los años desde cachorros si se quiere conservar sus piezas dentales.

Otro factor fundamental es la calidad del pienso. Algunas marcas han diseñado croquetas que limpian la superficie del diente y de la muela al masticarse.

Ultrasonido para perros

¿Se necesita anestesia para las limpiezas dentales de perros y gatos?

La limpieza dental en perros no es una técnica que pueda practicarse sin anestesia general , aunque hay veces que los propietarios no quieren anestesiar y si tiene poco sarro y el perro es muy bueno se puede intentar…… , pero no se va a poder pulir ni acceder a todas la zona de la boca …. Además los limpiadores dentales van a irrigar agua y hay riesgo de aspiración a vías respiratorias si no se realiza una anestesia correcta con intubación traqueal . En resumen , sin anestesia no se va hacer una correcta limpieza dental.

Tampoco sirve la sedación ya que necesitamos que el animal esté totalmente quieto, y el veterinario tenga un acceso completo a todas sus piezas dentales y encías.

Alimentos para la limpieza dental

Hay que tener cierto cuidado a la hora de comprar determinados alimentos porque no todos son saludables. Algunos tienen demasiado contenido graso, que en exceso puede causar problemas cardiovasculares y obesidad.

Los mejores alimentos para los dientes son aquellos que están elaborados por empresas farmacéuticas y llevan componentes químicos con tratamientos específicos para el diente del perro. Esto implica no solo limpieza a través de la acción mecánica de morder sino también un tratamiento antibacteriano para prevenir el sarro.

Conclusión

Si eres como la mayoría de dueños, por falta de tiempo , es probable que no estés prestando la suficiente atención a la limpieza dental de tu perro. Por eso te animamos a que comiences a limpiar los dientes de tu perro y consideres atender a su higiene bucal con frecuencia.

Estas simples medidas pueden conllevar a que tu perro tenga una vida más larga y mucho más saludable.

Si te resulta imposible introducir un cepillo de dientes a tu perro en la boca, pásate con él por clínica Tus Veterinarios y te explicamos cómo hacerlo.

Necesitas hacer una limpieza dental profesional a tu mascota?
Llámanos al 622575274 o contacta con nosotros

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *

¡Hola!