HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //usr/lib/python3/dist-packages/twisted/positioning/test/__pycache__/test_sentence.cpython-38.pyc
U


W[��@s�dZddlmZmZddlZddlmZddlmZdZ	dZ
Gdd	�d	e�ZGd
d�dej
�ZGdd
�d
ej�ZGdd�dej
�ZGdd�de�ZGdd�dee�ZdS)z"
Tests for positioning sentences.
�)�absolute_import�divisionN)�	_sentence)�TestCaseZsomeStringValueZsomeOtherStringValuec@seZdZdZedd��ZdS)�
DummyProtocolz"
    A simple, fake protocol.
    cCs
dttgS)N�type)�sentinelValueOne�sentinelValueTwo�r
r
�H/usr/lib/python3/dist-packages/twisted/positioning/test/test_sentence.py�getSentenceAttributessz#DummyProtocol.getSentenceAttributesN)�__name__�
__module__�__qualname__�__doc__�staticmethodrr
r
r
rrsrc@seZdZdZe��ZdS)�
DummySentencez*
    A sentence for L{DummyProtocol}.
    N)r
rrrrr�ALLOWED_ATTRIBUTESr
r
r
rrsrc@seZdZdZdeedgiZdS)�
MixinProtocolz�
    A simple, fake protocol that declaratively tells you the sentences
    it produces using L{base.PositioningSentenceProducerMixin}.
    N)r
rrrrr	�_SENTENCE_CONTENTSr
r
r
rr&s��rc@seZdZdZe��ZdS)�
MixinSentencez*
    A sentence for L{MixinProtocol}.
    N)r
rrrrrrr
r
r
rr5src@sJeZdZdZdd�Zdd�Zdd�ZdZd	Zddd
�Z	dd�Z
dd�ZdS)�SentenceTestsMixinzI
    Tests for positioning protocols and their respective sentences.
    cCs:t�}|�t|i�}|�t|t�|�|�t|t��dS)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�getattrZassertIsNoner	)�selfZthisSentinel�sentencer
r
r�test_attributeAccessAsz'SentenceTestsMixin.test_attributeAccesscCs|�i�}|�tt|d�dS)zM
        Accessing a nonexistent attribute raises C{AttributeError}.
        �BOGUSN�rZassertRaises�AttributeErrorr�rrr
r
r�"test_raiseOnMissingAttributeAccessMs
z5SentenceTestsMixin.test_raiseOnMissingAttributeAccesscCs"|�ddi�}|�tt|d�dS)z�
        Accessing bogus attributes raises C{AttributeError}, *even*
        when that attribute actually is in the sentence data.
        rNr r"r
r
r�test_raiseOnBadAttributeAccessUsz1SentenceTestsMixin.test_raiseOnBadAttributeAccessZtummiesz<%s (%s) {%s}>�unknown type�cCs|jj}|j|||fS)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}
        )rr
�reprTemplate)r�sentenceTypeZdataReprZclsNamer
r
r�
_expectedReprbsz SentenceTestsMixin._expectedReprcCs&|�i�}|��}|�t|�|�dS)zE
        Test the repr of an empty sentence of unknown type.
        N)rr)r�repr�rrZexpectedReprr
r
r�test_unknownTypeReprqs
z'SentenceTestsMixin.test_unknownTypeReprcCs0|�d|ji�}|�|j�}|�t|�|�dS)zC
        Test the repr of an empty sentence of known type.
        rN)rr(r)rr*r+r
r
r�test_knownTypeReprzsz%SentenceTestsMixin.test_knownTypeReprN)r%r&)r
rrrrr#r$r(r'r)r,r-r
r
r
rr=s	
	rc@s eZdZdZdd�Zdd�ZdS)�
MixinTestszm
    Tests for protocols deriving from L{base.PositioningSentenceProducerMixin}
    and their sentences.
    cCst�|_t|_dS)N)r�protocolrr)rr
r
r�setUp�szMixinTests.setUpcCs<|j��}|�d|�|jj}tj|���}|�d|�dS)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)r/rZassertNotInr�	itertools�chain�valuesZassertIn)rZsentenceAttributesZsentenceContentsZsentenceSpecAttributesr
r
r�test_noNoneInSentenceAttributes�s

z*MixinTests.test_noNoneInSentenceAttributesN)r
rrrr0r4r
r
r
rr.�sr.)rZ
__future__rrr1Ztwisted.positioningrZtwisted.trial.unittestrrr	rrZ
_BaseSentencerZ!_PositioningSentenceProducerMixinrrrr.r
r
r
r�<module>s
G