%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_base.cpython-312.pyc

�

Ϫ�f\t��@�dZddlmZddlmZddlmZddlmZm	Z	ddl
mZddlm
Z
Gd�d	e
�ZGd
�de
�ZGd�d
e
�Zdd�Zdd�ZGd�de
�ZGd�de
�ZGd�de
�ZGd�de
�ZGd�de
�ZGd�de
�ZGd�de
�Zy) z(
Test cases for positioning primitives.
�)�annotations)�verify)�base)�Angles�
Directions)�IPositioningBeacon)�TestCasec�0�eZdZdZdd�Zdd�Zdd�Zdd�Zy)�
AngleTestsz@
    Tests for the L{twisted.positioning.base.Angle} class.
    c�b�tj�}|jdt|��y)zd
        The repr of an empty angle says that is of unknown type and unknown
        value.
        z'<Angle of unknown type (unknown value)>N�r�Angle�assertEqual�repr��self�as  �D/usr/lib/python3/dist-packages/twisted/positioning/test/test_base.py�
test_emptyzAngleTests.test_emptys$��

�J�J�L�����B�D��G�L�c��tjtj��}|j	dt|��y)zf
        The repr of an empty variation says that it is a variation of unknown
        value.
        ��	angleTypez<Variation (unknown value)>N)rrr�	VARIATIONrrrs  r�test_variationzAngleTests.test_variations-��

�J�J��!1�!1�2�����6��Q��@rc�d�tjd�}|jdt|��y)zz
        The repr of an angle of unknown type but a given value displays that
        type and value in its repr.
        ��?z%<Angle of unknown type (1.0 degrees)>Nr
rs  r�test_unknownTypezAngleTests.test_unknownType%s&��

�J�J�s�O�����@�$�q�'�Jrc�P�|jttjd��y)zS
        Trying to create an angle with a bogus type raises C{ValueError}.
        �BOGUSrN)�assertRaises�
ValueErrorrr�rs r�test_bogusTypezAngleTests.test_bogusType-s��	
���*�d�j�j�G��DrN��return�None)�__name__�
__module__�__qualname__�__doc__rrrr$�rrrrs���M�A�K�Errc��eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
dd�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy)�HeadingTestszB
    Tests for the L{twisted.positioning.base.Heading} class.
    c��tjd�}|j|jd�|jt	|�d�|j|j�|j|j�y)z�
        Tests that a simple heading has a value in decimal degrees, which is
        also its value when converted to a float. Its variation, and by
        consequence its corrected heading, is L{None}.
        rN)r�Headingr�inDecimalDegrees�float�assertIsNone�	variation�correctedHeading�r�hs  r�test_simplezHeadingTests.test_simple9sb��
�L�L��������+�+�S�1�����q��3�'����!�+�+�&����!�,�,�-rc�h�tjd�}d}|jt|�|�y)zt
        A repr of a heading with no variation reports its value and that the
        variation is unknown.
        rz*<Heading (1.0 degrees, unknown variation)>N)rr0rr)r�heading�expectedReprs   r� test_headingWithoutVariationReprz-HeadingTests.test_headingWithoutVariationReprEs+��
�,�,�s�#��C������g���5rc��d\}}tjj||��}d}|jt	|�|j||��y)zu
        A repr of a heading with known variation reports its value and the
        value of that variation.
        )r�$���variationValuez2<Heading ({0} degrees, <Variation ({1} degrees)>)>N)rr0�
fromFloatsrr�format)r�angler4r:�reprTemplates     r�test_headingWithVariationReprz*HeadingTests.test_headingWithVariationReprNsM��
&���y��,�,�)�)�%�	�)�J��K������g���(;�(;�E�9�(M�Nrc�t�|jtjd�tjd��y)z>
        Headings with the same values compare equal.
        rN)rrr0r#s r�test_valueEqualityzHeadingTests.test_valueEqualityXs&��	
������c�*�D�L�L��,=�>rc�t�|jtjd�tjd��y)zA
        Headings with different values compare unequal.
        r�@N)�assertNotEqualrr0r#s r�test_valueInequalityz!HeadingTests.test_valueInequality^s&��	
���D�L�L��-�t�|�|�C�/@�Arc�.�tjd�y)zR
        Headings can be instantiated with a value of 0 and no variation.
        rN�rr0r#s r�test_zeroHeadingEdgeCasez%HeadingTests.test_zeroHeadingEdgeCaseds��	
���Q�rc�0�tjdd�y)zh
        Headings can be instantiated with a value of 0 and a variation of 180
        degrees.
        r�NrMr#s r�*test_zeroHeading180DegreeVariationEdgeCasez7HeadingTests.test_zeroHeading180DegreeVariationEdgeCasejs��
	
���Q��rc�d�|jttjjfi|��y)z�
        Helper function for verifying that bad values raise C{ValueError}.

        @param kw: The keyword arguments passed to L{base.Heading.fromFloats}.
        N)r!r"rr0rA)r�kws  r�
_badValueTestzHeadingTests._badValueTestqs%��	����*�d�l�l�&=�&=�D��Drc�(�|jd��y)zO
        Headings can not be instantiated with a value of 360 degrees.
        g�v@��
angleValueN�rTr#s r�test_badAngleValueEdgeCasez'HeadingTests.test_badAngleValueEdgeCasey���	
���e��,rc�(�|jd��y)zT
        Headings can not be instantiated with a variation of -180 degrees.
        ��f�r?NrXr#s r�test_badVariationEdgeCasez&HeadingTests.test_badVariationEdgeCase���	
���&��1rc�(�|jd��y)z>
        Negative heading values raise C{ValueError}.
        r>rVNrXr#s r�test_negativeHeadingz!HeadingTests.test_negativeHeading�rZrc�(�|jd��y)zK
        Heading values greater than C{360.0} raise C{ValueError}.
        g w@rVNrXr#s r�test_headingTooLargez!HeadingTests.test_headingTooLarge�rZrc�(�|jd��y)zK
        Variation values less than C{-180.0} raise C{ValueError}.
        g�g�r?NrXr#s r�test_variationTooNegativez&HeadingTests.test_variationTooNegative�r^rc�(�|jd��y)zM
        Variation values greater than C{180.0} raise C{ValueError}.
        g�g@r?NrXr#s r�test_variationTooPositivez&HeadingTests.test_variationTooPositive�s��	
���%��0rc���tjjdd��}|j|jtj
dtj��y)zQ
        A heading with a value and a variation has a corrected heading.
        rr>r?g&@N�rr0rArr5rr�HEADINGr6s  r�test_correctedHeadingz"HeadingTests.test_correctedHeading�sB��
�L�L�#�#�C��#�>������+�+�T�Z�Z��f�n�n�-M�Nrc���tjjdd��}|j|jtj
dtj��y)z�
        A heading with a value and a variation has the appropriate corrected
        heading value, even when the variation puts it across the 360 degree
        boundary.
        �pv@g�r?rNrhr6s  r�test_correctedHeadingOverflowz*HeadingTests.test_correctedHeadingOverflow��B��
�L�L�#�#�E�$�#�?������+�+�T�Z�Z��V�^�^�-L�Mrc���tjjdd��}|j|jtj
dtj��y)z�
        A heading with a value and a variation has the appropriate corrected
        heading value, even when the variation puts it exactly at the 360
        degree boundary.
        rl��r?�Nrhr6s  r�%test_correctedHeadingOverflowEdgeCasez2HeadingTests.test_correctedHeadingOverflowEdgeCase�rnrc���tjjdd��}|j|jtj
dtj��y)z�
        A heading with a value and a variation has the appropriate corrected
        heading value, even when the variation puts it under the 0 degree
        boundary.
        rrIr?rlNrhr6s  r�test_correctedHeadingUnderflowz+HeadingTests.test_correctedHeadingUnderflow�sB��
�L�L�#�#�C��#�<������+�+�T�Z�Z��v�~�~�-N�Orc���tjjdd��}|j|jtj
dtj��y)z�
        A heading with a value and a variation has the appropriate corrected
        heading value, even when the variation puts it exactly at the 0
        degree boundary.
        rr?rqNrhr6s  r�&test_correctedHeadingUnderflowEdgeCasez3HeadingTests.test_correctedHeadingUnderflowEdgeCase�sB��
�L�L�#�#�C��#�<������+�+�T�Z�Z��V�^�^�-L�Mrc�"�tjjdd��}|jd�|j	|j
jd�|jd�|j	|j
jd�y)zK
        Setting the sign of a heading changes the variation sign.
        rr?����rpN)rr0rA�setSignrr4r1r6s  r�test_setVariationSignz"HeadingTests.test_setVariationSign�sg��
�L�L�#�#�C��#�<��	�	�	�!��������5�5�s�;�	�	�	�"�
�������5�5�t�<rc���tjjdd��}|jt|j
d�|j
|jjd�|jt|j
d�|j
|jjd�|jt|j
d�|j
|jjd�y)z�
        Setting the sign of a heading to values that aren't C{-1} or C{1}
        raises C{ValueError} and does not affect the heading.
        rr?����r�2N)	rr0rAr!r"rzrr4r1r6s  r�test_setBadVariationSignz%HeadingTests.test_setBadVariationSign�s���

�L�L�#�#�C��#�<�����*�a�i�i��5�������5�5�s�;����*�a�i�i��3�������5�5�s�;����*�a�i�i��4�������5�5�s�;rc���tjjd�}|j|jj
�|j
t|jd�y)zd
        Setting the sign on a heading with unknown variation raises
        C{ValueError}.
        rrxN)	rr0rAr3r4r1r!r"rzr6s  r�test_setUnknownVariationSignz)HeadingTests.test_setUnknownVariationSign�sF��

�L�L�#�#�C�(�����!�+�+�6�6�7����*�a�i�i��3rNr%)rSr2r&r')r(r)r*r+r8r<rErGrKrNrQrTrYr]r`rbrdrfrjrmrrrtrvr{rr�r,rrr.r.4s}���
.�6�O�?�B���E�-�2�-�-�2�1�O�N�N�P�N�=�
<�4rr.c���eZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zdd
�Zdd�Z
dd�Zdd
�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zdd�Zy)�CoordinateTestsc�d�tjd�}|jt|�d�y)z9
        Coordinates can be converted to floats.
        �$@N)r�
Coordinaterr2�r�
coordinates  r�
test_floatzCoordinateTests.test_float�s'���_�_�T�*�
�����z�*�D�1rc�p�tjd�}dd�d�}|jt|�|�y)zn
        Coordinates that aren't explicitly latitudes or longitudes have an
        appropriate repr.
        r�z<Angle of unknown type (�
 degrees)>N)rr�rr�rr�r;s   r�	test_reprzCoordinateTests.test_repr�s5��
�_�_�T�*�
�1�$��z�B������j�)�<�8rc��tjdtj�}dd�d�}|j	t|�|�y)zU
        Positive latitudes have a repr that specifies their type and value.
        r��<Latitude (r�N�rr�r�LATITUDErrr�s   r�test_positiveLatitudez%CoordinateTests.test_positiveLatitude�s;���_�_�T�6�?�?�;�
�$�T�F�*�5������j�)�<�8rc��tjdtj�}dd�d�}|j	t|�|�y)zU
        Negative latitudes have a repr that specifies their type and value.
        �I�r�r�Nr�r�s   r�test_negativeLatitudez%CoordinateTests.test_negativeLatitudes;���_�_�U�F�O�O�<�
�$�U�G�:�6������j�)�<�8rc��tjdtj�}dd�d�}|j	t|�|�y)zV
        Positive longitudes have a repr that specifies their type and value.
        �I@�<Longitude (r�N�rr�r�	LONGITUDErr�r�	longituder;s   r�test_positiveLongitudez&CoordinateTests.test_positiveLongitudes<���O�O�D�&�*:�*:�;�	�%�d�V�:�6������i��,�7rc��tjdtj�}dd�d�}|j	t|�|�y)zV
        Negative longitudes have a repr that specifies their type and value.
        r�r�r�Nr�r�s   r�test_negativeLongitudez&CoordinateTests.test_negativeLongitudes<���O�O�E�6�+;�+;�<�	�%�e�W�J�7������i��,�7rc�P�|jttjdd�y)zM
        Creating coordinates with bogus types rasies C{ValueError}.
        ��b@r N)r!r"rr�r#s r�test_bogusCoordinateTypez(CoordinateTests.test_bogusCoordinateTypes��	
���*�d�o�o�u�g�Frc�l�|jttjdtj
�y)zm
        Creating coordinates with angle types that aren't coordinates raises
        C{ValueError}.
        r�N)r!r"rr�rrir#s r�test_angleTypeNotCoordinatez+CoordinateTests.test_angleTypeNotCoordinate"s ��
	
���*�d�o�o�u�f�n�n�Mrc�D�dd�}|j|�|��y)zE
        Coordinates with the same value and type are equal.
        c�J�tjdtj�S)Nr�rr�rr�r,rr�makeCoordinatez5CoordinateTests.test_equality.<locals>.makeCoordinate.s���?�?�3��(8�(8�9�9rN)r&�base.Coordinate)r)rr�s  r�
test_equalityzCoordinateTests.test_equality)s��
	:�	
����)�>�+;�<rc�|�tjd�}tjd�}|j||�y)zA
        Coordinates with different values aren't equal.
        rrpN)rr�rJ�r�c1�c2s   r�test_differentAnglesInequalityz.CoordinateTests.test_differentAnglesInequality3s0���_�_�S�
!��
�_�_�T�
"�����B��#rc��tjdtj�}tjdtj�}|j||�y)zT
        Coordinates with the same values but different types aren't equal.
        rN)rr�rr�r�rJr�s   r�test_differentTypesInequalityz-CoordinateTests.test_differentTypesInequality;s>���_�_�S�&�/�/�
2��
�_�_�S�&�"2�"2�
3�����B��#rc��tjdtj�}|j	d�|j|jd�|j	d�|j|jd�y)zh
        Setting the sign on a coordinate sets the sign of the value of the
        coordinate.
        r�rxryr�N)rr�rr�rzrr1�r�cs  r�	test_signzCoordinateTests.test_signCsZ��

�O�O�D�&�/�/�2��	�	�	�!������+�+�T�2�	�	�	�"�
�����+�+�U�3rc��d}tj|tj�}|j	t
|jd�|j|jd�|j	t
|jd�|j|jd�|j	t
|jd�|j|jd�y)z�
        Setting a bogus sign value (not -1 or 1) on a coordinate raises
        C{ValueError} and doesn't affect the coordinate.
        r�r}rr~N)	rr�rr�r!r"rzrr1)r�valuer�s   r�test_badVariationSignz%CoordinateTests.test_badVariationSignNs���
���O�O�E�6�?�?�3�����*�a�i�i��5�����+�+�T�2����*�a�i�i��3�����+�+�T�2����*�a�i�i��4�����+�+�T�2rc��tjdtj�}|j	|j
tj�y)zD
        Positive latitudes are in the northern hemisphere.
        rN)rr�rr�r�
hemispherer�NORTHr�s  r�test_northernHemispherez'CoordinateTests.test_northernHemisphere_s4���_�_�S�&�/�/�:�
�����.�.�
�0@�0@�Arc��tjdtj�}|j	|j
tj�y)zD
        Positive longitudes are in the eastern hemisphere.
        rN)rr�rr�rr�r�EASTr�s  r�test_easternHemispherez&CoordinateTests.test_easternHemispherefs4���_�_�S�&�*:�*:�;�
�����.�.�
���@rc��tjdtj�}|j	|j
tj�y)zD
        Negative latitudes are in the southern hemisphere.
        rpN)rr�rr�rr�r�SOUTHr�s  r�test_southernHemispherez'CoordinateTests.test_southernHemispherems4���_�_�T�6�?�?�;�
�����.�.�
�0@�0@�Arc��tjdtj�}|j	|j
tj�y)zD
        Negative longitudes are in the western hemisphere.
        rpN)rr�rr�rr�r�WESTr�s  r�test_westernHemispherez&CoordinateTests.test_westernHemispherets4���_�_�T�6�+;�+;�<�
�����.�.�
���@rc�d��tjdd��|jt�fd��y)zo
        Accessing the hemisphere for a coordinate that can't compute it
        raises C{ValueError}.
        rNc����jS)N)r�)r�s�r�<lambda>z4CoordinateTests.test_badHemisphere.<locals>.<lambda>�s
���j�.C�.C�r)rr�r!r"r�s @r�test_badHemispherez"CoordinateTests.test_badHemisphere{s&���
�_�_�S�$�/�
����*�&C�Drc�p�|jttd�|jttd�y)zt
        Creating a latitude with a value greater than or equal to 90 degrees
        raises C{ValueError}.
        r�g�V@N�r!r"�
_makeLatituder#s r�test_latitudeTooLargez%CoordinateTests.test_latitudeTooLarge�s(��
	
���*�m�U�;����*�m�T�:rc�p�|jttd�|jttd�y)zr
        Creating a latitude with a value less than or equal to -90 degrees
        raises C{ValueError}.
        g�b�g�V�Nr�r#s r�test_latitudeTooSmallz%CoordinateTests.test_latitudeTooSmall�s(��
	
���*�m�V�<����*�m�U�;rc�p�|jttd�|jttd�y)zv
        Creating a longitude with a value greater than or equal to 180 degrees
        raises C{ValueError}.
        g@o@g�f@N�r!r"�_makeLongituder#s r�test_longitudeTooLargez&CoordinateTests.test_longitudeTooLarge�s(��
	
���*�n�e�<����*�n�e�<rc�p�|jttd�|jttd�y)zt
        Creating a longitude with a value less than or equal to -180 degrees
        raises C{ValueError}.
        g@o�r\Nr�r#s r�test_longitudeTooSmallz&CoordinateTests.test_longitudeTooSmall�s(��
	
���*�n�f�=����*�n�f�=rc��tjdtj�}|j	|j
d�tjdtj�}|j	|j
d�y)zQ
        Coordinate values can be accessed in degrees, minutes, seconds.
        g@I@)r~�rg%��CI@)r~��.N)rr�rr�r�inDegreesMinutesSecondsr�s  r�test_inDegreesMinutesSecondsz,CoordinateTests.test_inDegreesMinutesSeconds�sX��
�O�O�D�&�/�/�2������2�2�K�@��O�O�F�F�O�O�4������2�2�L�Arc�f�tjdd�}|j|j�y)zz
        If the vaue of a coordinate is L{None}, its values in degrees,
        minutes, seconds is also L{None}.
        N)rr�r3r�r�s  r�(test_unknownAngleInDegreesMinutesSecondsz8CoordinateTests.test_unknownAngleInDegreesMinutesSeconds�s(��

�O�O�D�$�'�����!�3�3�4rNr%)r(r)r*r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r,rrr�r��s���2�9�9�9�8�8�G�N�=�$�$�	4�3�"B�A�B�A�E�;�<�=�>�B�5rr�c�J�tj|tj�S)z7
    Builds and returns a latitude of given value.
    )rr�rr��r�s rr�r��s���?�?�5�&�/�/�2�2rc�J�tj|tj�S)z8
    Builds and returns a longitude of given value.
    r�r�s rr�r��s���?�?�5�&�"2�"2�3�3rc�0�eZdZdZdd�Zdd�Zdd�Zdd�Zy)�
AltitudeTestszC
    Tests for the L{twisted.positioning.base.Altitude} class.
    c��tjd�}|jt|�d�|j|jd�|j|j
dtjz�y)z�
        Altitudes can be instantiated and reports the correct value in
        meters and feet, as well as when converted to float.
        rN)r�Altituderr2�inMeters�inFeet�METERS_PER_FOOT�r�altitudes  r�
test_valuezAltitudeTests.test_value�s[��
�=�=��%������x��#�.�����*�*�C�0�������#��0D�0D�*D�Erc�d�tjd�}|jt|�d�y)zF
        Altitudes report their type and value in their repr.
        rz<Altitude (1.0 m)>N)rr�rrr�s  rr�zAltitudeTests.test_repr�s'���=�=��%������h��)=�>rc�|�tjd�}tjd�}|j||�y)z<
        Altitudes with equal values compare equal.
        rN)rr�r�r�
firstAltitude�secondAltitudes   rr�zAltitudeTests.test_equality�s0���
�
�c�*�
����s�+�������7rc�|�tjd�}tjd�}|j||�y)zF
        Altitudes with different values don't compare equal.
        rrpN)rr�rJr�s   r�test_inequalityzAltitudeTests.test_inequality�s0���
�
�c�*�
����t�,�����M�>�:rNr%)r(r)r*r+r�r�r�r�r,rrr�r��s���F�?�8�;rr�c�8�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zy)	�
SpeedTestsz@
    Tests for the L{twisted.positioning.base.Speed} class.
    c��tjd�}|j|jd�|jt	|�d�y)��
        Speeds can be instantiated, and report their value in meters
        per second, and can be converted to floats.
        r�N)r�Speedr�inMetersPerSecondr2�r�speeds  rr�zSpeedTests.test_value��<��
�
�
�4� ������0�0�$�7�����u��t�,rc�d�tjd�}|jt|�d�y)zC
        Speeds report their type and value in their repr.
        r�z<Speed (50.0 m/s)>N)rr�rrr�s  rr�zSpeedTests.test_repr��'���
�
�4� ������e��&:�;rc�N�|jttjd�y)zA
        Creating a negative speed raises C{ValueError}.
        rpN)r!r"rr�r#s r�test_negativeSpeedszSpeedTests.test_negativeSpeedss��	
���*�d�j�j�$�7rc��tjd�}|jdtjz|j�y)zC
        A speed can be converted into its value in knots.
        rrxN)rr�r�MPS_PER_KNOT�inKnotsr�s  r�test_inKnotszSpeedTests.test_inKnots�0���
�
�3�������T�.�.�.��
�
�>rc�`�|jdttjd���y)z;
        A speed can be converted into a C{float}.
        rN)rr2rr�r#s r�test_asFloatzSpeedTests.test_asFloat
�!��	
����e�D�J�J�s�O�4�5rNr%)	r(r)r*r+r�r�r�rrr,rrr�r��s ���-�<�8�?�6rr�c�8�eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zy)	�
ClimbTestsz6
    Tests for L{twisted.positioning.base.Climb}.
    c��tjd�}|j|jd�|jt	|�d�y)r��E@N�r�Climbrr�r2�r�climbs  rr8zClimbTests.test_simpler�rc�d�tjd�}|jt|�d�y)zC
        Climbs report their type and value in their repr.
        r
z<Climb (42.0 m/s)>N)rrrrr
s  rr�zClimbTests.test_repr"r�rc��tjd�}|j|jd�|jt	|�d�y)z�
        Climbs can have negative values, and still report that value
        in meters per second and when converted to floats.
        gE�Nrr
s  r�test_negativeClimbszClimbTests.test_negativeClimbs)s<��
�
�
�5�!������0�0�%�8�����u��u�-rc��tjd�}|jdtjz|j�y)zC
        A climb can be converted into its value in knots.
        rrxN)rrrrrr
s  r�test_speedInKnotszClimbTests.test_speedInKnots2rrc�`�|jdttjd���y)z;
        A climb can be converted into a C{float}.
        rN)rr2rrr#s rrzClimbTests.test_asFloat9rrNr%)	r(r)r*r+r8r�rrrr,rrrrs ���-�<�.�?�6rrc��eZdZdZdd�Zdd�Zdd�Zdd�Zdd�Zdd�Z	dd�Z
dd	�Zd
Z										dd�Z
dd�Zdd
�Zdd�Zy)�PositionErrorTestsz>
    Tests for L{twisted.positioning.base.PositionError}.
    c���tj�}|j|j�|j|j�|j|j
�y)z~
        In an empty L{base.PositionError} with no invariant testing, all
        dilutions of positions are L{None}.
        N�r�
PositionErrorr3�pdop�hdop�vdop�r�
positionErrors  r�
test_allUnsetz PositionErrorTests.test_allUnsetEsN��
�*�*�,�
����-�,�,�-����-�,�,�-����-�,�,�-rc���tjd��}|j|j�|j|j�|j|j
�y)z{
        In an empty L{base.PositionError} with invariant testing, all
        dilutions of positions are L{None}.
        T)�
testInvariantNrrs  r�test_allUnsetWithInvariantz-PositionErrorTests.test_allUnsetWithInvariantOsP��
�*�*��>�
����-�,�,�-����-�,�,�-����-�,�,�-rc�h�tjd��}|j|jd�y)zN
        L{base.PositionError}s can be instantiated with just a HDOP.
        r)rN�rrrrrs  r�test_withoutInvariantz(PositionErrorTests.test_withoutInvariantYs*���*�*��4�
�����+�+�S�1rc�j�tjdd��}|j|jd�y)zv
        Creating a simple L{base.PositionError} with just a HDOP while
        checking the invariant works.
        rT)rr!Nr$rs  r�test_withInvariantz%PositionErrorTests.test_withInvariant`s,��
�*�*��4�H�
�����+�+�S�1rc���tjddd��}|j|jd�|j|jd�|j|j
d�y)z�
        Creating a L{base.PositionError} with values set to an impossible
        combination works if the invariant is not checked.
        r)rrrN)rrrrrr)r�errors  r�test_invalidWithoutInvariantz/PositionErrorTests.test_invalidWithoutInvarianthsT��
�"�"��#�C�@��������S�)�������S�)�������S�)rc�V�|jttjdddd��y)z�
        Creating a L{base.PositionError} with values set to an impossible
        combination raises C{ValueError} if the invariant is being tested.
        rT)rrrr!N)r!r"rrr#s r�test_invalidWithInvariantz,PositionErrorTests.test_invalidWithInvariantrs/��
	
�����������
	�	
rc�x�tjdd��}d|_|j|jd�y)z}
        You can set the PDOP value to value inconsisted with HDOP and VDOP
        when not checking the invariant.
        r�rr�Y@N)rrrr)r�pes  r�test_setDOPWithoutInvariantz.PositionErrorTests.test_setDOPWithoutInvariant�s1��
�
�
�S�s�
3�����������%�(rc��tjddd��}|j}dd�}|jt||�|j|j|�y)z�
        Attempting to set the PDOP value to value inconsisted with HDOP and
        VDOP when checking the invariant raises C{ValueError}.
        rT)rrr!c��d|_y)Nr/)r)r0s r�setPDOPz<PositionErrorTests.test_setDOPWithInvariant.<locals>.setPDOP�s	���B�GrN)r0�base.PositionErrorr&r')rrrr!r"r)rr0rr4s    r�test_setDOPWithInvariantz+PositionErrorTests.test_setDOPWithInvariant�sN��
�
�
�S�s�$�
G���w�w��	�	
���*�g�r�2�������$�'rz.<PositionError (pdop: %s, hdop: %s, vdop: %s)>c��|j|j|�|j|j|�|j|j|�|jt	|�|j
|||fz�y)a�
        Tests the DOP values in a position error, and the repr of that
        position error.

        @param pe: The position error under test.
        @type pe: C{PositionError}
        @param pdop: The expected position dilution of precision.
        @type pdop: C{float} or L{None}
        @param hdop: The expected horizontal dilution of precision.
        @type hdop: C{float} or L{None}
        @param vdop: The expected vertical dilution of precision.
        @type vdop: C{float} or L{None}
        N)rrrrr�
REPR_TEMPLATE)rr0rrrs     r�_testDOPzPositionErrorTests._testDOP�sf��(	
������$�'�������$�'�������$�'�����b��4�#5�#5��t�T�8J�#J�Krc��d\}}|dz|dzz
dz}tj||��}|j||||�y)zF
        The VDOP is correctly determined from PDOP and HDOP.
        �rIr���?)rrN�rrr9)rrrrr0s     r�test_positionAndHorizontalSetz0PositionErrorTests.test_positionAndHorizontalSet��H���
��d��a��$��'�!�c�)��
�
�
�T��
5���
�
�b�$��d�+rc��d\}}|dz|dzz
dz}tj||��}|j||||�y)zF
        The HDOP is correctly determined from PDOP and VDOP.
        r;r<r=)rrNr>)rrrrr0s     r�test_positionAndVerticalSetz.PositionErrorTests.test_positionAndVerticalSet�r@rc��d\}}|dz|dzzdz}tj||��}|j||||�y)zF
        The PDOP is correctly determined from HDOP and VDOP.
        )rrr<r=r.Nr>)rrrrr0s     r�test_horizontalAndVerticalSetz0PositionErrorTests.test_horizontalAndVerticalSet�r@rNr%)
r0r5r�float | NonerrErrEr&r')r(r)r*r+rr"r%r'r*r,r1r6r8r9r?rBrDr,rrrr@s����.�.�2�2�*�
�)�(�E�M�L��L��L��	L�
�L�
�
L�2,�,�,rrc�4�eZdZdZd	d�Zdddd�Zd	d�Zd	d�Zy)
�BeaconInformationTestszB
    Tests for L{twisted.positioning.base.BeaconInformation}.
    c��tj�}|jt|j�d�d}|jt|�|�y)z�
        For an empty beacon information object, the number of used
        beacons is zero, the number of seen beacons is zero, and the
        repr of the object reflects that.
        rz><BeaconInformation (used beacons (0): [], unused beacons: [])>N)r�BeaconInformationr�len�usedBeaconsr)r�bir;s   r�test_minimalz#BeaconInformationTests.test_minimal�sI���
#�
#�
%������R�^�^�,�a�0�R�	�	
����b��<�0rrxr)�azimuth�	elevation�signalToNoiseRatioc�l��d	�fd�}t�}tdd�D]}|j||����tj|�}�jt
|j�d��jt
|j�d��jt|�d�y)
zw
        Tests a beacon information with a bunch of satellites, none of
        which used in computing a fix.
        c�z��t�j�}|j|�tjdi|��S)Nr,)�dict�satelliteKwargs�updater�	Satellite)rS�kwargsrs  �r�_buildSatellitez;BeaconInformationTests.test_simple.<locals>._buildSatellite�s1����$�.�.�/�F��M�M�"���>�>�+�F�+�+rrx�
)�
identifier�	ra<BeaconInformation (used beacons (0): [], unused beacons: [<Satellite (1), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (2), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (3), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (4), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (5), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (6), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (7), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (8), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (9), azimuth: 1, elevation: 1, snr: 1.0>])>N)rSr2r&zbase.Satellite)
�set�range�addrrIrrJ�seenBeaconsrKr)rrX�beacons�prnrLs`    rr8z"BeaconInformationTests.test_simple�s����	,�
�%����B�<�	9�C��K�K��3�7�8�	9��
#�
#�G�
,������R�^�^�,�a�0�����R�^�^�,�a�0������H�
�	
rc���tj�}tdd�D]_}tjd	d|i|j��}|j
j
|�|dzs�E|jj
|��a|jt|j
�d�|jt|j�d�|jt|�d�y)
zv
        Tests a beacon information with a bunch of satellites, some of
        them used in computing a fix.
        rxrYrZr<r[�a<BeaconInformation (used beacons (5): [<Satellite (1), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (3), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (5), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (7), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (9), azimuth: 1, elevation: 1, snr: 1.0>], unused beacons: [<Satellite (2), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (4), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (6), azimuth: 1, elevation: 1, snr: 1.0>, <Satellite (8), azimuth: 1, elevation: 1, snr: 1.0>])>Nr,)rrIr]rVrTr_r^rKrrJr)rrLra�	satellites    r�test_someSatellitesUsedz.BeaconInformationTests.test_someSatellitesUseds���
�
#�
#�
%����B�<�	.�C����N�#�N��9M�9M�N�I��N�N���y�)��Q�w����"�"�9�-�		.�	
����R�^�^�,�a�0�����R�^�^�,�a�0������H�

E�
	
rNr%)r(r)r*r+rMrTr8rer,rrrGrG�s%���1�#$�!�3�O�O�!
�F
rrGc� �eZdZdZdd�Zdd�Zy)�PositioningBeaconTestsz.
    Tests for L{base.PositioningBeacon}.
    c���tjtj�}|j	|�tjttjd��y)zX
        Tests that L{base.PositioningBeacon} implements L{IPositioningBeacon}.
        rxN)r�
implementedByr�PositioningBeacon�
assertTruer�verifyObject)r�
implementss  r�test_interfacez%PositioningBeaconTests.test_interface*sB��(�5�5�d�6L�6L�M�
����
�#����.��0F�0F�q�0I�Jrc�`�|jttjd��d�y)z9
        Tests the repr of a positioning beacon.
        �Az<Beacon (A)>N)rrrrjr#s rr�z PositioningBeaconTests.test_repr2s$��	
����d�4�4�S�9�:�N�KrNr%)r(r)r*r+rnr�r,rrrgrg%s���K�Lrrgc� �eZdZdZdd�Zdd�Zy)�SatelliteTestsz:
    Tests for L{twisted.positioning.base.Satellite}.
    c�>�tjd�}|j|jd�|j	|j
�|j	|j�|j	|j�|jt|�d�y)z�
        Tests a minimal satellite that only has a known PRN.

        Tests that the azimuth, elevation and signal to noise ratios
        are L{None} and verifies the repr.
        rxz:<Satellite (1), azimuth: None, elevation: None, snr: None>N)	rrVrrZr3rNrOrPr�r�ss  rrMzSatelliteTests.test_minimal>sv��
�N�N�1���������q�)����!�)�)�$����!�+�+�&����!�.�.�/������G�T�	
rc�L�tjdddd��}|j|jd�|j|jd�|j|j
d�|j|jd�|jt|�d�y)z�
        Tests a minimal satellite that only has a known PRN.

        Tests that the azimuth, elevation and signal to noise ratios
        are correct and verifies the repr.
        rxg�p@g>@g9@)rZrNrOrPz;<Satellite (1), azimuth: 270.0, elevation: 30.0, snr: 25.0>N)rrVrrZrNrOrPrrts  rr8zSatelliteTests.test_simpleNs���
�N�N��%�4�D�
��	
������q�)�������E�*�������d�+�����-�-�t�4������G�U�	
rNr%)r(r)r*r+rMr8r,rrrrrr9s���
� 
rrrN)r�r2r&r�)r+�
__future__r�zope.interfacer�twisted.positioningr�twisted.positioning.baserr� twisted.positioning.ipositioningr�twisted.trial.unittestr	rr.r�r�r�r�r�rrrGrgrrr,rr�<module>r}s����#�!�$�7�?�+�!E��!E�Ht4�8�t4�nH5�h�H5�V3�4�$;�H�$;�N&6��&6�R)6��)6�XK,��K,�\T
�X�T
�nL�X�L�(&
�X�&
r

Zerion Mini Shell 1.0