%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/twisted/positioning/test/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/twisted/positioning/test/__pycache__/test_sentence.cpython-312.pyc

�

Ϫ�fZ����dZddlZddlmZddlmZdZdZGd�d�ZGd	�d
ej�Z
Gd�dej�ZGd
�dej�Z
Gd�d�ZGd�dee�Zy)z"
Tests for positioning sentences.
�N)�	_sentence)�TestCase�someStringValue�someOtherStringValuec� �eZdZdZed��Zy)�
DummyProtocolz"
    A simple, fake protocol.
    c��dttgS)N�type)�sentinelValueOne�sentinelValueTwo���H/usr/lib/python3/dist-packages/twisted/positioning/test/test_sentence.py�getSentenceAttributesz#DummyProtocol.getSentenceAttributess���(�*:�;�;rN)�__name__�
__module__�__qualname__�__doc__�staticmethodrr
rrrrs����<��<rrc�0�eZdZdZej�Zy)�
DummySentencez*
    A sentence for L{DummyProtocol}.
    N)rrrrrr�ALLOWED_ATTRIBUTESr
rrrr����'�<�<�>�rrc��eZdZdZdeedgiZy)�
MixinProtocolz�
    A simple, fake protocol that declaratively tells you the sentences
    it produces using L{base.PositioningSentenceProducerMixin}.
    N)rrrrrr�_SENTENCE_CONTENTSr
rrrr#s"���	
����
��rrc�0�eZdZdZej�Zy)�
MixinSentencez*
    A sentence for L{MixinProtocol}.
    N)rrrrrrrr
rrrr2rrrc�>�eZdZdZd�Zd�Zd�ZdZdZdd�Z	d�Z
d	�Zy
)�SentenceTestsMixinzI
    Tests for positioning protocols and their respective sentences.
    c���t�}|jt|i�}|jt	|t�|�|jt	|t��y)z�
        A sentence attribute gets the correct value, and accessing an
        unset attribute (which is specified as being a valid sentence
        attribute) gets L{None}.
        N)�object�
sentenceClassr�assertEqual�getattr�assertIsNoner)�self�thisSentinel�sentences   r�test_attributeAccessz'SentenceTestsMixin.test_attributeAccess?sO���x���%�%�'7��&F�G�������+;�<�l�K����'�(�,<�=�>rc�^�|ji�}|jtt|d�y)zM
        Accessing a nonexistent attribute raises C{AttributeError}.
        �BOGUSN�r#�assertRaises�AttributeErrorr%�r'r)s  r�"test_raiseOnMissingAttributeAccessz5SentenceTestsMixin.test_raiseOnMissingAttributeAccessJs(���%�%�b�)�����.�'�8�W�Erc�b�|jddi�}|jtt|d�y)z�
        Accessing bogus attributes raises C{AttributeError}, *even*
        when that attribute actually is in the sentence data.
        r,Nr-r0s  r�test_raiseOnBadAttributeAccessz1SentenceTestsMixin.test_raiseOnBadAttributeAccessQs,��
�%�%�w��o�6�����.�'�8�W�Er�tummiesz<%s (%s) {%s}>c�R�|jj}|j|||fzS)aQ
        Builds the expected repr for a sentence.

        @param sentenceType: The name of the sentence type (e.g "GPGGA").
        @type sentenceType: C{str}
        @param dataRepr: The repr of the data in the sentence.
        @type dataRepr: C{str}
        @return: The expected repr of the sentence.
        @rtype: C{str}
        )r#r�reprTemplate)r'�sentenceType�dataRepr�clsNames    r�
_expectedReprz SentenceTestsMixin._expectedRepr\s-���$�$�-�-��� � �G�\�8�#D�D�Drc�|�|ji�}|j�}|jt|�|�y)zE
        Test the repr of an empty sentence of unknown type.
        N)r#r:r$�repr�r'r)�expectedReprs   r�test_unknownTypeReprz'SentenceTestsMixin.test_unknownTypeReprjs6���%�%�b�)���)�)�+������h���6rc��|jd|ji�}|j|j�}|jt	|�|�y)zC
        Test the repr of an empty sentence of known type.
        r
N)r#r7r:r$r<r=s   r�test_knownTypeReprz%SentenceTestsMixin.test_knownTypeReprrsI���%�%�v�t�/@�/@�&A�B���)�)�$�*;�*;�<������h���6rN)zunknown type�)rrrrr*r1r3r7r6r:r?rAr
rrr r :s4���	?�F�F��L�#�L�E�7�7rr c��eZdZdZd�Zd�Zy)�
MixinTestszm
    Tests for protocols deriving from L{base.PositioningSentenceProducerMixin}
    and their sentences.
    c�8�t�|_t|_y)N)r�protocolrr#)r's r�setUpzMixinTests.setUp�s��%���
�*��rc���|jj�}|jd|�|jj}t	j
|j
��}|jd|�y)a�
        L{None} does not appear in the sentence attributes of the
        protocol, even though it's in the specification.

        This is because L{None} is a placeholder for parts of the sentence you
        don't really need or want, but there are some bits later on in the
        sentence that you do want. The alternative would be to have to specify
        things like "_UNUSED0", "_UNUSED1"... which would end up cluttering
        the sentence data and eventually adapter state.
        N)rFr�assertNotInr�	itertools�chain�values�assertIn)r'�sentenceAttributes�sentenceContents�sentenceSpecAttributess    r�test_noNoneInSentenceAttributesz*MixinTests.test_noNoneInSentenceAttributes�s`��"�]�]�@�@�B������1�2��=�=�;�;��!*���2B�2I�2I�2K�!L���
�
�d�2�3rN)rrrrrGrQr
rrrDrD{s���
+�4rrD)rrJ�twisted.positioningr�twisted.trial.unittestrrrr�
_BaseSentencer�!_PositioningSentenceProducerMixinrrr rDr
rr�<module>rVs{���
�)�+�$��)��<�<�?�I�+�+�?��I�?�?��?�I�+�+�?�>7�>7�B4��-�4r

Zerion Mini Shell 1.0