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

Ϫ�f[S����dZddlmZmZmZddlmZGd�d�ZGd�d�ZGd�d	ej�Z
Gd
�de�ZGd�d
ej�Z
Gd�dej�Zy)z_
This module contains tests for L{twisted.internet.task.Cooperator} and
related functionality.
�)�defer�reactor�task)�unittestc��eZdZdZd�Zd�Zy)�FakeDelayedCallzA
    Fake delayed call which lets us simulate the scheduler.
    c� �||_d|_y)z+
        A function to run, later.
        FN)�func�	cancelled��selfr
s  �>/usr/lib/python3/dist-packages/twisted/test/test_cooperator.py�__init__zFakeDelayedCall.__init__s����	����c��d|_y)z.
        Don't run my function later.
        TN)r�r
s r�cancelzFakeDelayedCall.cancels����rN)�__name__�
__module__�__qualname__�__doc__rr�rrrrs����rrc�"�eZdZdZd�Zd�Zd�Zy)�
FakeSchedulerz/
    A fake scheduler for testing against.
    c��g|_y)zD
        Create a fake scheduler with a list of work to do.
        N)�workrs rrzFakeScheduler.__init__&s����	rc�R�t|�}|jj|�|S)z;
        Schedule a unit of work to be done later.
        )rr�append)r
�thunk�units   r�__call__zFakeScheduler.__call__,s%���u�%���	�	������rc�t�|jgc}|_|D]}|jr�|j��!y)zL
        Do all of the work that is currently available to be done.
        N)rrr
)r
rr s   r�pumpzFakeScheduler.pump4s4���)�)�R���d�i��	�D��>�>��	�	��	rN)rrrrrr!r#rrrrr!s�����rrc�p�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zy)�CooperatorTests�donec�X�|jtj�|jS�N)�trapr�SchedulerStopped�RESULT)r
�errs  r�ebIterzCooperatorTests.ebIterAs������&�&�'��{�{�rc�$�|j�yr()�fail)r
�igns  r�cbIterzCooperatorTests.cbIterEs���	�	�rc�D����fd���d�j�fd��S)zU
        Test that Cooperators refuse new tasks when they have been stopped.
        c���tj�}|j�|jt	d�|�}|j�j�|j�j�|j�fd��S)Nrc�<���j|�j�Sr(��assertEqualr+��resultr
s �r�<lambda>zNCooperatorTests.testStoppedRejectsNewTasks.<locals>.testwith.<locals>.<lambda>Ss����0@�0@�����0U�r)	r�
Cooperator�stop�	coiterate�iter�addCallbackr1�
addErrbackr-)�stuff�c�dr
s   �r�testwithz<CooperatorTests.testStoppedRejectsNewTasks.<locals>.testwithMs\������!�A�
�F�F�H����D��H�e�,�A�
�M�M�$�+�+�&�
�L�L����%��=�=�!U�V�VrNc�8���tj��Sr()r�Deferred)r0rCs �rr9z<CooperatorTests.testStoppedRejectsNewTasks.<locals>.<lambda>Us���h�u�~�~�?O�6P�r)r>)r
rCs`@r�testStoppedRejectsNewTasksz*CooperatorTests.testStoppedRejectsNewTasksHs!���
	W���~�)�)�*P�Q�Qrc�,���tj�}d��d�_|j���}|j	�j
�|j
�j�|j���fd�}|j	|�|S)zq
        Test that a running iterator will not run to completion when the
        cooperator is stopped.
        c3�6K�td�Ed{���y7��w)N�)�rangerrr�myiterz/CooperatorTests.testStopRunning.<locals>.myiter^s�����Q�x���s������c�v���j|�j��j�jd�y�NrL)r6r+�value)r8rKr
s ��r�	doassertsz2CooperatorTests.testStopRunning.<locals>.doassertsgs+������V�T�[�[�1����V�\�\�2�.r)	rr:rOr<r>r1r?r-r;)r
rArBrPrKs`   @r�testStopRunningzCooperatorTests.testStopRunningWsp���

�O�O���	 ����
�K�K���!��	�
�
�d�k�k�"�	���T�[�[�!�	����	/�	
�
�
�i� ��rc�~�����tj��tj�����fd�}tj���j	|��}��fd�}�j|�|j�j�|j�j�|j�fd��S)z�
        An iterator run with L{Cooperator.coiterate} paused on a L{Deferred}
        yielded by that iterator will fire its own L{Deferred} (the one
        returned by C{coiterate}) when L{Cooperator.stop} is called.
        c3�x�K�tjd�jd�����j�y�w�Nr)r�	callLater�callbackr/)�outstandingDr
�testControlDs���rrKz3CooperatorTests.testStopOutstanding.<locals>.myiterws.��������a��!6�!6��=����I�I�K�s�7:c�H���j��jd�y)N�arglebargle)r;rV)r0rArWs ��r�	stopAndGoz6CooperatorTests.testStopOutstanding.<locals>.stopAndGos���
�F�F�H��!�!�-�0rc�<���j|�j�Sr(r5r7s �rr9z5CooperatorTests.testStopOutstanding.<locals>.<lambda>�s���D�,<�,<�V�T�[�[�,Q�r)	rrErr:r<r>r1r?r-)r
rKrBr[rArWrXs`   @@@r�testStopOutstandingz#CooperatorTests.testStopOutstandingns�����~�~�'���~�~�'��	�

�O�O���
�K�K���!��	1�	� � ��+�	�
�
�d�k�k�"�	���T�[�[�!��}�}�Q�R�Rrc��tj�}d�}|j|��}|j|t�S)Nc3� K�	t���wr()�RuntimeErrorrrrrKz3CooperatorTests.testUnexpectedError.<locals>.myiter�s�����#�n�$�s��rr:r<�
assertFailurer`)r
rArKrBs    r�testUnexpectedErrorz#CooperatorTests.testUnexpectedError�s8���O�O���	%�
�K�K���!���!�!�!�\�2�2rc��d�}tj�}|j|��}|j|t�S)Nc3�K�tj�}tjd|jt��|��y�wrT)rrErrU�errbackr`)�Ds rrKz@CooperatorTests.testUnexpectedErrorActuallyLater.<locals>.myiter�s/������� �A����a����L�N�;��G�s�AAra�r
rKrArBs    r� testUnexpectedErrorActuallyLaterz0CooperatorTests.testUnexpectedErrorActuallyLater�s8��	�

�O�O���
�K�K���!���!�!�!�\�2�2rc��d�}tj�}|j|��}|j|t�S)Nc3�JK�tjt����y�wr()rr/r`rrrrKzCCooperatorTests.testUnexpectedErrorNotActuallyLater.<locals>.myiter�s�����*�*�\�^�,�,�s�!#rarhs    r�#testUnexpectedErrorNotActuallyLaterz3CooperatorTests.testUnexpectedErrorNotActuallyLater�s8��	-�
�O�O���
�K�K���!���!�!�!�\�2�2rc�����g��fd�}gd��tj�}g}�D](}|j|j||����*t	j
|�j
���fd��S)Nc3�F�K�|D]}�j|�d���y�wr(�r)�things�th�Ls  �rrKz/CooperatorTests.testCooperation.<locals>.myiter�s&������
��������
�
�s�!)�abc���rI�def)���c�Z���jt��tt��d��S�Nr)r6�tuple�sum�zip)r0rr�groupsOfThingsr
s ���rr9z1CooperatorTests.testCooperation.<locals>.<lambda>�s$����(�(��q��3�s�N�7K�R�3P�Q�r)rr:rr<r�DeferredListr>)r
rKrA�tasksr@rrr�s`    @@r�testCooperationzCooperatorTests.testCooperation�sp�����	�
>���O�O�����#�	5�E��L�L����V�E�]�3�4�	5��!�!�%�(�4�4�Q�
�	
rc����g���fd�}Gd�d��tj���}|j|��j|j�|j
j
�|j�|j�|j�j�|j�ttd���y)Nc3�p�K�td�D]#}�j|�|dk(rd�_|���%y�w)N�d�	T)rJr�stopped)�i�_TPF�outputs ��rrKz6CooperatorTests.testResourceExhaustion.<locals>.myiter�s9������3�Z�
���
�
�a� ���6�#'�D�L���	
�s�36c��eZdZdZd�Zy)�4CooperatorTests.testResourceExhaustion.<locals>._TPFFc��|jSr()r�rs rr!z=CooperatorTests.testResourceExhaustion.<locals>._TPF.__call__�s���|�|�#rN)rrrr�r!rrrr�r��s���G�
$rr�)�terminationPredicateFactory�
)rr:r<r?r-�_delayedCallr�_tickr;�
assertTruer�r6�listrJ)r
rKrAr�r�s   @@r�testResourceExhaustionz&CooperatorTests.testResourceExhaustion�s������	�	$�	$�
�O�O��=��	���F�H��(�(����5�	������	
���	�	����������%������e�B�i��1rc�b������g�Gd�d�����fd�}tj|d�����jtd��}g���fd�}|j	|�d}�sH|d	z
}�r'�jd�j
�|d	z
}�r�'|d
kDr�jd��s�Gyy)
a*
        If a callback to a deferred returned by coiterate calls coiterate on
        the same Cooperator, we should make sure to only do the minimal amount
        of scheduling work.  (This test was added to demonstrate a specific bug
        that was found while writing the scheduler.)
        c��eZdZd�Zdefd�Zy)�9CooperatorTests.testCallbackReCoiterate.<locals>.FakeCallc��||_yr(�r
rs  rrzBCooperatorTests.testCallbackReCoiterate.<locals>.FakeCall.__init__�s	�� ��	r�returnc�"�d|j�d�S)Nz
<FakeCall �>r�rs r�__repr__zBCooperatorTests.testCallbackReCoiterate.<locals>.FakeCall.__repr__�s��#�D�I�I�=��2�2rN)rrrr�strr�rrr�FakeCallr��s��
!�
3�#�
3rr�c�r���j�t����j�|���dSrN)�assertFalse�reprr)�fr��callsr
s ���r�schedz6CooperatorTests.testCallbackReCoiterate.<locals>.sched�s1������U�D��K�0��L�L��!��%���9�rc��d�S)Nc��y�NTrrrrr9zKCooperatorTests.testCallbackReCoiterate.<locals>.<lambda>.<locals>.<lambda>���rrrrrr9z9CooperatorTests.testCallbackReCoiterate.<locals>.<lambda>�s���r��	schedulerr�rc�l���jtd��j�j�yr|)r<r=�addBothr)r0rAr&s ��r�anotherTaskz<CooperatorTests.testCallbackReCoiterate.<locals>.anotherTask�s"���
�K�K��R��!�)�)�$�+�+�6rrru�2zCooperator took too longN)rr:r<r=r>�popr
r/)	r
r�rBr�rr�rAr�r&s	`    @@@@r�testCallbackReCoiteratez'CooperatorTests.testCallbackReCoiterate�s������	3�	3�	�

�O�O��9M�
��
�K�K��R��!����	7�	
�
�
�k�"�����A�I�D���	�	�!��!�!�#���	����b�y��	�	�4�5�
rc����dg��fd�}tj|��}|jtddg��}|jtddg��}|j	�dj
|j�|j�|j�dj�|j	|j�d�|j�|j�dj�|j|j�|jtddg��|j�dj�|j	|j�d�y)a
        If the last task in a Cooperator is removed, the scheduled call for
        the next tick is cancelled, since it is no longer necessary.

        This behavior is useful for tests that want to assert they have left
        no reactor state behind when they're done.
        Nc�*��t|��d<�dSrT)r)r�r�s �rr�zFCooperatorTests.test_removingLastTaskStopsScheduledCall.<locals>.scheds���&�q�)�E�!�H���8�Or)r�rurvr)
rr:�	cooperater=r6r
r�r;r�rr�r��assertIsNone)r
r��coop�task1�task2r�s     @r�'test_removingLastTaskStopsScheduledCallz7CooperatorTests.test_removingLastTaskStopsScheduledCall�s%������	�����/�����t�Q��F�|�,�����t�Q��F�|�,������q�����
�
�3�	�
�
������q��+�+�,�����*�*�E�!�H�5�	�
�
������a��*�*�+����$�+�+�,�	
���t�Q��F�|�$�����q��+�+�,�����*�*�E�!�H�5rc�b�tj�}|j|j�y)zm
        L{Cooperator.running} reports C{True} if the L{Cooperator}
        was started on creation.
        N)rr:r��running�r
rAs  r�test_runningWhenStartedz'CooperatorTests.test_runningWhenStarted"s ��

�O�O�������	�	�"rc�f�tjd��}|j|j�y)zk
        L{Cooperator.running} reports C{False} if the L{Cooperator}
        has not been started.
        F��startedN)rr:r�r�r�s  r�test_runningWhenNotStartedz*CooperatorTests.test_runningWhenNotStarted*s$��

�O�O�E�*��������#rc��tjd��}|j�|j|j�|j|j�y)zb
        L{Cooperator.running} reports C{True} when the L{Cooperator}
        is running.
        Fr�N)rr:�start�
addCleanupr;r�r�r�s  r�test_runningWhenRunningz'CooperatorTests.test_runningWhenRunning2s;��

�O�O�E�*��	���	������������	�	�"rc��tjd��}|j�|j�|j	|j
�y)zj
        L{Cooperator.running} reports C{False} after the L{Cooperator}
        has been stopped.
        Fr�N)rr:r�r;r�r�r�s  r�test_runningWhenStoppedz'CooperatorTests.test_runningWhenStopped<s6��

�O�O�E�*��	���	�	����������#rN)rrrr+r-r1rFrQr]rcrirlr�r�r�r�r�r�r�r�rrrr%r%>s[��
�F���
R��.S�6
3�3�3�
�&2�4(6�T"6�H#�$�#�$rr%c��eZdZdZy)�UnhandledExceptionz0
    An exception that should go unhandled.
    N)rrrrrrrr�r�Gs��rr�c��eZdZdZd�Zy)�
AliasTestszg
    Integration test to verify that the global singleton aliases do what
    they're supposed to.
    c����tj���fd�}|�}tj|�}|j	|tj
j��S)zZ
        L{twisted.internet.task.cooperate} ought to run the generator that it is
        c3�H�K�d��d��d���jd�y�w)NrurvrI�yay)rV)rBs�r�doitz'AliasTests.test_cooperate.<locals>.doitYs"������G��G��G�
�J�J�u��s�")rrErr��assertIn�_theCooperator�_tasks)r
r��it�theTaskrBs    @r�test_cooperatezAliasTests.test_cooperateSsL���
�N�N���	��V���.�.��$���
�
�g�t�2�2�9�9�:��rN)rrrrr�rrrr�r�Ms���
rr�c��eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zy)�
RunStateTestsz�
    Tests to verify the behavior of L{CooperativeTask.pause},
    L{CooperativeTask.resume}, L{CooperativeTask.stop}, exhausting the
    underlying iterator, and their interactions with each other.
    c�8�d|_d|_d|_g|_t	�|_t
j|j
d���|_|jj|j��|_|jj�y)z�
        Create a cooperator with a fake scheduler and a termination predicate
        that ensures only one unit of work will take place per tick.
        Fc��d�S)Nc��yr�rrrrr9z7RunStateTests.setUp.<locals>.<lambda>.<locals>.<lambda>zr�rrrrrr9z%RunStateTests.setUp.<locals>.<lambda>zs���rr�N)�_doDeferNext�_doStopNext�
_doDieNextrrr�rr:�
cooperatorr��workerr�rs r�setUpzRunStateTests.setUplsu��
"��� ��������	�&�����/�/��n�n�)=�	
����O�O�-�-�d�k�k�m�<��	������rc#�.K�d}	|dz
}|jr;d|_tj�}|jj	|�|��nB|j
ry|jr
t��|jj	|�|�����w)z�
        This is a sample generator which yields Deferreds when we are testing
        deferral and an ascending integer count otherwise.
        rruFN)r�rrErrr�r�r�)r
r�rBs   rr�zRunStateTests.workers�����

���
��F�A�� � �$)��!��N�N�$���	�	� � ��#����!�!�����(�*�*��	�	� � ��#����s�BBc��|`|`y)z�
        Drop references to interesting parts of the fixture to allow Deferred
        errors to be noticed when things start failing.
        N)rr�rs r�tearDownzRunStateTests.tearDown�s��

�I��Nrc��d|_y)z@
        Defer the next result from my worker iterator.
        TN)r�rs r�	deferNextzRunStateTests.deferNext�s��!��rc��d|_y)zm
        Make the next result from my worker iterator be completion (raising
        StopIteration).
        TN)r�rs r�stopNextzRunStateTests.stopNext�s��
 ��rc��d�}d|_y)zk
        Make the next result from my worker iterator be raising an
        L{UnhandledException}.
        c�.�|jt�yr()r)r�)�failures r�ignoreUnhandledz.RunStateTests.dieNext.<locals>.ignoreUnhandled�s���L�L�+�,�rTN)r�)r
r�s  r�dieNextzRunStateTests.dieNext�s��	���rc�f�|jj�|j|jdg�|jj�|j|jddg�|jj�|jj�|j|jddg�|jj
�|j|jddg�|jj�|j|jgd��y)z�
        Cooperators should stop running their tasks when they're paused, and
        start again when they're resumed.
        rurvrtN)r�r#r6rr�pause�resumers r�test_pauseResumezRunStateTests.test_pauseResume�s���	
������������Q�C�(�������������Q��F�+�	
�	�	����������������Q��F�+��	�	����������Q��F�+�������������I�.rc�<�|jtj|jj�|jj	�|jj�|jtj|jj�y)z�
        L{CooperativeTask.resume} should raise a L{TaskNotPaused} exception if
        it was not paused; e.g. if L{CooperativeTask.pause} was not invoked
        more times than L{CooperativeTask.resume} on that object.
        N)�assertRaisesr�	NotPausedr�r�rs r�test_resumeNotPausedz"RunStateTests.test_resumeNotPaused�s^��	
���$�.�.�$�)�)�*:�*:�;��	�	�����	�	�������$�.�.�$�)�)�*:�*:�;rc��|jj�|jj�|j	|j
g�|jj�|jj�|j	|j
g�|jj
�|jj�|j	|j
g�|jj
�|jj�|j	|j
dg�y)z~
        Pauses on tasks should behave like a stack. If a task is paused twice,
        it needs to be resumed twice.
        ruN)rr�r�r#r6rr�rs r�test_pauseTwicezRunStateTests.test_pauseTwice�s���	
�	�	����������������B�'��	�	����������������B�'��	�	����������������B�'��	�	����������������Q�C�(rc���|j�|jj�|jt	|j
�d�|j
|j
dtj�|jj�|jt	|j
�d�|jj�|jj�|jt	|j
�d�|jj�|jj�|jt	|j
�d�|j
djd�|jj�|jt	|j
�d�|j|j
dd�y)a
        C{pause()}ing a task while it is waiting on an outstanding
        L{defer.Deferred} should put the task into a state where the
        outstanding L{defer.Deferred} must be called back I{and} the task is
        C{resume}d before it will continue processing.
        rurzSTUFF!rvN)
r�r�r#r6�lenr�assertIsInstancerrErr�r�rVrs r�test_pauseWhileDeferredz%RunStateTests.test_pauseWhileDeferred�s>��	
��������������T�Y�Y���+����d�i�i��l�E�N�N�;�����������T�Y�Y���+��	�	��������������T�Y�Y���+��	�	��������������T�Y�Y���+��	�	�!����h�'�����������T�Y�Y���+�������1��q�)rc�����|jj�}|jj�}g�g�g}g}�fd�}�fd�}|j|�|j|�|j|j�|j|j�|j	�|j
j
�|jt��d�|jt��d�|j�d|jj�|j�d|jj�|j|dg�|j|dg�y)a/
        L{CooperativeTask.whenDone} returns a Deferred which fires when the
        Cooperator's iterator is exhausted.  It returns a new Deferred each
        time it is called; callbacks added to other invocations will not modify
        the value that subsequent invocations will fire with.
        c�(���j|�y)Nruro)r8�results1s �r�callbackOnez0RunStateTests.test_whenDone.<locals>.callbackOne�����O�O�F�#�rc�(���j|�y)Nrvro)r8�results2s �r�callbackTwoz0RunStateTests.test_whenDone.<locals>.callbackTworrrurrvN)r�whenDoner>rr�r�r#r6r��assertIs�	_iterator)	r
�	deferred1�	deferred2�final1�final2r�rr�rs	       @@r�
test_whenDonezRunStateTests.test_whenDones(����I�I�&�&�(�	��I�I�&�&�(�	���������	�	�	���k�*����k�*����f�m�m�,����f�m�m�,�	
�
�
������������X���*�����X���*��
�
�h�q�k�4�9�9�#6�#6�7��
�
�h�q�k�4�9�9�#6�#6�7�����!��%�����!��%rc�T�|jj�}g}|j|j�|j	�|j
j
�|jt|�d�|j|djt�t�y)z�
        L{CooperativeTask.whenDone} returns a L{defer.Deferred} that will fail
        when the iterable's C{next} method raises an exception, with that
        exception.
        rurN)rrr?rr�r�r#r6r��checkr�)r
r�resultss   r�test_whenDoneErrorz RunStateTests.test_whenDoneError/s{���I�I�&�&�(�	������W�^�^�,���������������W��q�)�������)�)�*<�=�?Q�Rrc�\�|jj�}g}|j|j�|jj	�|jt
|�d�|j|djtj�tj�y)z�
        L{CooperativeTask.whenDone} returns a L{defer.Deferred} that fails with
        L{TaskStopped} when the C{stop} method is called on that
        L{CooperativeTask}.
        rurN)	rrr?rr;r6r�r
�TaskStopped)r
r�errorss   r�test_whenDoneStopzRunStateTests.test_whenDoneStop=sx���I�I�&�&�(�	������V�]�]�+��	�	��������V��a�(����������)9�)9�:�D�<L�<L�Mrc��|j�|jj�g}|jj	�j|j�|j||jjg�y)z�
        L{CooperativeTask.whenDone} will return a L{defer.Deferred} that will
        succeed immediately if its iterator has already completed.
        N)	r�r�r#rrr>rr6r)r
rs  r�test_whenDoneAlreadyDonez&RunStateTests.test_whenDoneAlreadyDoneJs^��
	
�
�
�����������	�	����(�(����8�����4�9�9�#6�#6�"7�8rc���|jj�|jj�|j	t|j�d�|jtj|jj�|jtj|jj�|jj�|j	|jg�y)z�
        C{stop()}ping a task should cause it to be removed from the run just as
        C{pause()}ing, with the distinction that C{resume()} will raise a
        L{TaskStopped} exception.
        rN)
rr;r�r#r6r�rr�rr�rs r�test_stopStopszRunStateTests.test_stopStopsUs���	
�	�	��������������T�Y�Y���+����$�*�*�D�I�I�N�N�;����$�*�*�D�I�I�O�O�<�������������B�'rc��|jj�|jj�|jj�|jj�|j
|jg�y)z�
        C{resume()}ing a paused, stopped task should be a no-op; it should not
        raise an exception, because it's paused, but neither should it actually
        do more work from the task.
        N)rr�r;r�r�r#r6rrs r�test_pauseStopResumez"RunStateTests.test_pauseStopResumedsT��	
�	�	�����	�	�����	�	����������������B�'rc�b�|j�|jj�|jj	�}|j|jjd�g}|j|j�|jj�|jj�|jj�|jd�|jj�|j|dg�|j|jg�y)a
        As a corrolary of the interaction of C{pause()} and C{unpause()},
        C{stop()}ping a task which is waiting on a L{Deferred} should cause the
        task to gracefully shut down, meaning that it should not be unpaused
        when the deferred fires.
        ru�N)r�r�r#rr�r6r�_pauseCountr�rr;rV)r
rBrs   r�test_stopDeferredzRunStateTests.test_stopDeferredps���	
�����������I�I�M�M�O��������.�.��2���	�	�	�'�.�.�!��������	�	����������	�
�
�1�
�������
	
����4�&�)�������B�'rc��|j�|jj�|jtj
|jj�y)zx
        C{stop()}ping a L{CooperativeTask} whose iterator has been exhausted
        should raise L{TaskDone}.
        N)r�r�r#r�r�TaskDoner;rs r�test_stopExhaustedz RunStateTests.test_stopExhausted�s9��
	
�
�
�����������$�-�-������8rc��|j�|jj�|jtj
|jj�y)z�
        C{stop()}ping a L{CooperativeTask} whose iterator has encountered an
        error should raise L{TaskFailed}.
        N)r�r�r#r�r�
TaskFailedr;rs r�test_stopErroredzRunStateTests.test_stopErrored�s9��
	
�������������$�/�/�4�9�9�>�>�:rc����g���fd�}�jj�j|��j��jj��j
��jjdg�y)a�
        If a callback of a L{Deferred} from L{CooperativeTask.whenDone} calls
        C{Cooperator.stop} on its L{CooperativeTask._cooperator}, the
        L{Cooperator} will stop, but the L{CooperativeTask} whose callback is
        calling C{stop} should already be considered 'stopped' by the time the
        callback is running, and therefore removed from the
        L{CoooperativeTask}.
        c�~���j|��jj��jd�y)Nr&)rr�r;)r8�callbackPhasesr
s ��r�stopitz;RunStateTests.test_stopCooperatorReentrancy.<locals>.stopit�s1����!�!�&�)��O�O� � �"�
�!�!�&�)rr&N)rrr>r�r�r#r6r)r
r'r&s` @r�test_stopCooperatorReentrancyz+RunStateTests.test_stopCooperatorReentrancy�sd�����	*�	
�	�	����(�(��0��
�
������������$�)�)�*=�*=�v�)F�GrN)rrrrr�r�r�r�r�r�r�r�r�r�rrrrrrrr r#r(rrrr�r�eso��� �&�*�!� �
�/�,	<�)�,*�0)&�VS�N�	9�
(�
(�(�49�;�Hrr�N)r�twisted.internetrrr�
twisted.trialrrr�TestCaser%�	Exceptionr�r�r�rrr�<module>r-sr���2�1�"���&��:F$�h�'�'�F$�R�����"�"��0MH�H�%�%�MHr
¿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!