AnonSec Shell
Server IP : 209.38.156.173  /  Your IP : 216.73.216.122   [ Reverse IP ]
Web Server : Apache/2.4.52 (Ubuntu)
System : Linux lakekumayuhotel 5.15.0-136-generic #147-Ubuntu SMP Sat Mar 15 15:53:30 UTC 2025 x86_64
User : root ( 0)
PHP Version : 8.1.2-1ubuntu2.22
Disable Function : NONE
Domains : 2 Domains
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/twisted/positioning/test/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     [ BACKUP SHELL ]     [ JUMPING ]     [ MASS DEFACE ]     [ SCAN ROOT ]     [ SYMLINK ]     

Current File : /usr/lib/python3/dist-packages/twisted/positioning/test/__pycache__/test_base.cpython-310.pyc
o

�b�p�@s�dZddlmZddlmZddlmZmZddlm	Z	ddl
mZGdd�de�ZGd	d
�d
e�Z
Gdd�de�Zd
d�Zdd�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZGdd�de�ZdS) z(
Test cases for positioning primitives.
�)�verify)�base)�Angles�
Directions)�IPositioningBeacon)�TestCasec@�0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
AngleTestsz@
    Tests for the L{twisted.positioning.base.Angle} class.
    cCst��}|�dt|��dS)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�a�r�D/usr/lib/python3/dist-packages/twisted/positioning/test/test_base.py�
test_emptyszAngleTests.test_emptycCs"tjtjd�}|�dt|��dS)zf
        The repr of an empty variation says that it is a variation of unknown
        value.
        ��	angleTypez<Variation (unknown value)>N)rrr�	VARIATIONrr
rrrr�test_variationszAngleTests.test_variationcCst�d�}|�dt|��dS)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
rrrr�test_unknownType#s
zAngleTests.test_unknownTypecCs|jttjdd�dS)zS
        Trying to create an angle with a bogus type raises C{ValueError}.
        �BOGUSrN)�assertRaises�
ValueErrorrr�rrrr�test_bogusType+�zAngleTests.test_bogusTypeN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr	sr	c@s�eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.S)/�HeadingTestszB
    Tests for the L{twisted.positioning.base.Heading} class.
    cCsDt�d�}|�|jd�|�t|�d�|�|j�|�|j�dS)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�hrrr�test_simple7s

zHeadingTests.test_simplecCs"t�d�}d}|�t|�|�dS)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)rr%rr
)r�heading�expectedReprrrr� test_headingWithoutVariationReprCs
z-HeadingTests.test_headingWithoutVariationReprcCs8d\}}tjj||d�}d}|�t|�|�||��dS)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)rr%�
fromFloatsrr
�format)r�angler)r.�reprTemplaterrr�test_headingWithVariationReprLsz*HeadingTests.test_headingWithVariationReprcCs|�t�d�t�d��dS)z>
        Headings with the same values compare equal.
        rN)rrr%rrrr�test_valueEqualityV�zHeadingTests.test_valueEqualitycCs|�t�d�t�d��dS)zA
        Headings with different values compare unequal.
        r�@N)�assertNotEqualrr%rrrr�test_valueInequality\r:z!HeadingTests.test_valueInequalitycCst�d�dS)zR
        Headings can be instantiated with a value of 0 and no variation.
        rN�rr%rrrr�test_zeroHeadingEdgeCaseb�z%HeadingTests.test_zeroHeadingEdgeCasecCst�dd�dS)zh
        Headings can be instantiated with a value of 0 and a variation of 180
        degrees.
        r�Nr>rrrr�*test_zeroHeading180DegreeVariationEdgeCasehsz7HeadingTests.test_zeroHeading180DegreeVariationEdgeCasecKs|jttjjfi|��dS)z�
        Helper function for verifying that bad values raise C{ValueError}.

        @param kw: The keyword arguments passed to L{base.Heading.fromFloats}.
        N)rrrr%r4)r�kwrrr�
_badValueTestoszHeadingTests._badValueTestcC�|jdd�dS)zO
        Headings can not be instantiated with a value of 360 degrees.
        g�v@��
angleValueN�rDrrrr�test_badAngleValueEdgeCasew�z'HeadingTests.test_badAngleValueEdgeCasecCrE)zT
        Headings can not be instantiated with a variation of -180 degrees.
        ��f�r2NrHrrrr�test_badVariationEdgeCase}rJz&HeadingTests.test_badVariationEdgeCasecCrE)z>
        Negative heading values raise C{ValueError}.
        r1rFNrHrrrr�test_negativeHeading�rJz!HeadingTests.test_negativeHeadingcCrE)zK
        Heading values greater than C{360.0} raise C{ValueError}.
        g w@rFNrHrrrr�test_headingTooLarge�rJz!HeadingTests.test_headingTooLargecCrE)zK
        Variation values less than C{-180.0} raise C{ValueError}.
        g�g�r2NrHrrrr�test_variationTooNegative�rJz&HeadingTests.test_variationTooNegativecCrE)zM
        Variation values greater than C{180.0} raise C{ValueError}.
        g�g@r2NrHrrrr�test_variationTooPositive�rJz&HeadingTests.test_variationTooPositivecC�,tjjddd�}|�|jt�dtj��dS)zQ
        A heading with a value and a variation has a corrected heading.
        rr1r2g&@N�rr%r4rr*rr�HEADINGr+rrr�test_correctedHeading�sz"HeadingTests.test_correctedHeadingcCrQ)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�r2rNrRr+rrr�test_correctedHeadingOverflow��z*HeadingTests.test_correctedHeadingOverflowcCrQ)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.
        rU��r2�NrRr+rrr�%test_correctedHeadingOverflowEdgeCase�rWz2HeadingTests.test_correctedHeadingOverflowEdgeCasecCrQ)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.
        rr;r2rUNrRr+rrr�test_correctedHeadingUnderflow�rWz+HeadingTests.test_correctedHeadingUnderflowcCs,tjjddd�}|�|jt�dtj��dS)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.
        rr2rYNrRr+rrr�&test_correctedHeadingUnderflowEdgeCase�rWz3HeadingTests.test_correctedHeadingUnderflowEdgeCasecCsHtjjddd�}|�d�|�|jjd�|�d�|�|jjd�dS)zK
        Setting the sign of a heading changes the variation sign.
        rr2����rXN)rr%r4�setSignrr)r&r+rrr�test_setVariationSign�s


z"HeadingTests.test_setVariationSigncCsttjjddd�}|�t|jd�|�|jjd�|�t|jd�|�|jjd�|�t|jd�|�|jjd�dS)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.
        rr2����r�2N)	rr%r4rrr_rr)r&r+rrr�test_setBadVariationSign�sz%HeadingTests.test_setBadVariationSigncCs.tj�d�}|�|jj�|�t|jd�dS)zd
        Setting the sign on a heading with unknown variation raises
        C{ValueError}.
        rr]N)	rr%r4r(r)r&rrr_r+rrr�test_setUnknownVariationSign�sz)HeadingTests.test_setUnknownVariationSignN)r r!r"r#r-r0r8r9r=r?rBrDrIrLrMrNrOrPrTrVrZr[r\r`rcrdrrrrr$2s0	
				
r$c@s�eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dd�Z
dd�Zdd�Zdd�Z
dd�Zdd�Zdd�Zdd�Zdd �Zd!d"�Zd#d$�Zd%d&�Zd'd(�Zd)d*�Zd+d,�Zd-d.�Zd/d0�Zd1S)2�CoordinateTestscCst�d�}|�t|�d�dS)z9
        Coordinates can be converted to floats.
        �$@N)r�
Coordinaterr'�r�
coordinaterrr�
test_float��
zCoordinateTests.test_floatcCs*t�d�}dd�d�}|�t|�|�dS)zn
        Coordinates that aren't explicitly latitudes or longitudes have an
        appropriate repr.
        rfz<Angle of unknown type (�
 degrees)>N)rrgrr
�rrir/rrr�	test_repr�s
zCoordinateTests.test_reprcC�.t�dtj�}dd�d�}|�t|�|�dS)zU
        Positive latitudes have a repr that specifies their type and value.
        rf�<Latitude (rlN�rrgr�LATITUDErr
rmrrr�test_positiveLatitude��z%CoordinateTests.test_positiveLatitudecCro)zU
        Negative latitudes have a repr that specifies their type and value.
        �I�rprlNrqrmrrr�test_negativeLatitudertz%CoordinateTests.test_negativeLatitudecCro)zV
        Positive longitudes have a repr that specifies their type and value.
        �I@�<Longitude (rlN�rrgr�	LONGITUDErr
�r�	longituder/rrr�test_positiveLongitude
rtz&CoordinateTests.test_positiveLongitudecCro)zV
        Negative longitudes have a repr that specifies their type and value.
        rurxrlNryr{rrr�test_negativeLongitudertz&CoordinateTests.test_negativeLongitudecCs|�ttjdd�dS)zM
        Creating coordinates with bogus types rasies C{ValueError}.
        ��b@rN)rrrrgrrrr�test_bogusCoordinateTyperz(CoordinateTests.test_bogusCoordinateTypecCs|�ttjdtj�dS)zm
        Creating coordinates with angle types that aren't coordinates raises
        C{ValueError}.
        rN)rrrrgrrSrrrr�test_angleTypeNotCoordinate sz+CoordinateTests.test_angleTypeNotCoordinatecCsdd�}|�|�|��dS)zE
        Coordinates with the same value and type are equal.
        cSst�dtj�S)Nr�rrgrrzrrrr�makeCoordinate,sz5CoordinateTests.test_equality.<locals>.makeCoordinateN)r)rr�rrr�
test_equality'szCoordinateTests.test_equalitycC�$t�d�}t�d�}|�||�dS)zA
        Coordinates with different values aren't equal.
        rrXN)rrgr<�r�c1�c2rrr�test_differentAnglesInequality1�

z.CoordinateTests.test_differentAnglesInequalitycCs,t�dtj�}t�dtj�}|�||�dS)zT
        Coordinates with the same values but different types aren't equal.
        rN)rrgrrrrzr<r�rrr�test_differentTypesInequality9sz-CoordinateTests.test_differentTypesInequalitycCsBt�dtj�}|�d�|�|jd�|�d�|�|jd�dS)zh
        Setting the sign on a coordinate sets the sign of the value of the
        coordinate.
        rwr]r^ruN)rrgrrrr_rr&�r�crrr�	test_signAs


zCoordinateTests.test_signcCspd}t�|tj�}|�t|jd�|�|jd�|�t|jd�|�|jd�|�t|jd�|�|jd�dS)z�
        Setting a bogus sign value (not -1 or 1) on a coordinate raises
        C{ValueError} and doesn't affect the coordinate.
        rwrarrbN)	rrgrrrrrr_rr&)r�valuer�rrr�test_badVariationSignLsz%CoordinateTests.test_badVariationSigncC�"t�dtj�}|�|jtj�dS)zD
        Positive latitudes are in the northern hemisphere.
        rN)rrgrrrr�
hemispherer�NORTHrhrrr�test_northernHemisphere]�z'CoordinateTests.test_northernHemispherecCr�)zD
        Positive longitudes are in the eastern hemisphere.
        rN)rrgrrzrr�r�EASTrhrrr�test_easternHemispheredr�z&CoordinateTests.test_easternHemispherecCr�)zD
        Negative latitudes are in the southern hemisphere.
        rXN)rrgrrrrr�r�SOUTHrhrrr�test_southernHemispherekr�z'CoordinateTests.test_southernHemispherecCr�)zD
        Negative longitudes are in the western hemisphere.
        rXN)rrgrrzrr�r�WESTrhrrr�test_westernHemisphererr�z&CoordinateTests.test_westernHemispherecs$t�dd��|�t�fdd��dS)zo
        Accessing the hemisphere for a coordinate that can't compute it
        raises C{ValueError}.
        rNcs�jS)N)r�r�rirr�<lambda>sz4CoordinateTests.test_badHemisphere.<locals>.<lambda>)rrgrrrrr�r�test_badHemisphereysz"CoordinateTests.test_badHemispherecC� |�ttd�|�ttd�dS)zt
        Creating a latitude with a value greater than or equal to 90 degrees
        raises C{ValueError}.
        rg�V@N�rr�
_makeLatituderrrr�test_latitudeTooLarge��z%CoordinateTests.test_latitudeTooLargecCr�)zr
        Creating a latitude with a value less than or equal to -90 degrees
        raises C{ValueError}.
        g�b�g�V�Nr�rrrr�test_latitudeTooSmall�r�z%CoordinateTests.test_latitudeTooSmallcCr�)zv
        Creating a longitude with a value greater than or equal to 180 degrees
        raises C{ValueError}.
        g@o@g�f@N�rr�_makeLongituderrrr�test_longitudeTooLarge�r�z&CoordinateTests.test_longitudeTooLargecCr�)zt
        Creating a longitude with a value less than or equal to -180 degrees
        raises C{ValueError}.
        g@o�rKNr�rrrr�test_longitudeTooSmall�r�z&CoordinateTests.test_longitudeTooSmallcCs<t�dtj�}|�|jd�t�dtj�}|�|jd�dS)zQ
        Coordinate values can be accessed in degrees, minutes, seconds.
        g@I@)rb�rg%��CI@)rb��.N)rrgrrrr�inDegreesMinutesSecondsr�rrr�test_inDegreesMinutesSeconds�sz,CoordinateTests.test_inDegreesMinutesSecondscCst�dd�}|�|j�dS)zz
        If the vaue of a coordinate is L{None}, its values in degrees,
        minutes, seconds is also L{None}.
        N)rrgr(r�r�rrr�(test_unknownAngleInDegreesMinutesSeconds�sz8CoordinateTests.test_unknownAngleInDegreesMinutesSecondsN)r r!r"rjrnrsrvr}r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrre�s2	

recC�t�|tj�S)z7
    Builds and returns a latitude of given value.
    )rrgrrr�r�rrrr��r@r�cCr�)z8
    Builds and returns a longitude of given value.
    r�r�rrrr��r@r�c@r)�
AltitudeTestszC
    Tests for the L{twisted.positioning.base.Altitude} class.
    cCs@t�d�}|�t|�d�|�|jd�|�|jdtj�dS)z�
        Altitudes can be instantiated and reports the correct value in
        meters and feet, as well as when converted to float.
        rN)r�Altituderr'�inMeters�inFeet�METERS_PER_FOOT�r�altituderrr�
test_value�s
zAltitudeTests.test_valuecC�t�d�}|�t|�d�dS)zF
        Altitudes report their type and value in their repr.
        rz<Altitude (1.0 m)>N)rr�rr
r�rrrrn�rkzAltitudeTests.test_reprcCs$t�d�}t�d�}|�||�dS)z<
        Altitudes with equal values compare equal.
        rN)rr�r�r�
firstAltitude�secondAltituderrrr��r�zAltitudeTests.test_equalitycCr�)zF
        Altitudes with different values don't compare equal.
        rrXN)rr�r<r�rrr�test_inequality�r�zAltitudeTests.test_inequalityN)r r!r"r#r�rnr�r�rrrrr��s
r�c@�8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
SpeedTestsz@
    Tests for the L{twisted.positioning.base.Speed} class.
    cC�,t�d�}|�|jd�|�t|�d�dS)��
        Speeds can be instantiated, and report their value in meters
        per second, and can be converted to floats.
        rwN)r�Speedr�inMetersPerSecondr'�r�speedrrrr���
zSpeedTests.test_valuecCr�)zC
        Speeds report their type and value in their repr.
        rwz<Speed (50.0 m/s)>N)rr�rr
r�rrrrn�rkzSpeedTests.test_reprcCs|�ttjd�dS)zA
        Creating a negative speed raises C{ValueError}.
        rXN)rrrr�rrrr�test_negativeSpeeds�szSpeedTests.test_negativeSpeedscC�"t�d�}|�dtj|j�dS)zC
        A speed can be converted into its value in knots.
        rr]N)rr�r�MPS_PER_KNOT�inKnotsr�rrr�test_inKnots�
zSpeedTests.test_inKnotscC�|�dtt�d���dS)z;
        A speed can be converted into a C{float}.
        rN)rr'rr�rrrr�test_asFloat�zSpeedTests.test_asFloatN)	r r!r"r#r�rnr�r�r�rrrrr��s	r�c@r�)
�
ClimbTestsz6
    Tests for L{twisted.positioning.base.Climb}.
    cCr�)r��E@N�r�Climbrr�r'�r�climbrrrr-r�zClimbTests.test_simplecCr�)zC
        Climbs report their type and value in their repr.
        r�z<Climb (42.0 m/s)>N)rr�rr
r�rrrrn rkzClimbTests.test_reprcCr�)z�
        Climbs can have negative values, and still report that value
        in meters per second and when converted to floats.
        gE�Nr�r�rrr�test_negativeClimbs'r�zClimbTests.test_negativeClimbscCr�)zC
        A climb can be converted into its value in knots.
        rr]N)rr�rr�r�r�rrr�test_speedInKnots0r�zClimbTests.test_speedInKnotscCr�)z;
        A climb can be converted into a C{float}.
        rN)rr'rr�rrrrr�7r�zClimbTests.test_asFloatN)	r r!r"r#r-rnr�r�r�rrrrr�s		r�c@steZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�ZdZdd�Z
dd�Zdd�Zdd�ZdS)�PositionErrorTestsz>
    Tests for L{twisted.positioning.base.PositionError}.
    cCs0t��}|�|j�|�|j�|�|j�dS)z~
        In an empty L{base.PositionError} with no invariant testing, all
        dilutions of positions are L{None}.
        N�r�
PositionErrorr(�pdop�hdop�vdop�r�
positionErrorrrr�
test_allUnsetCsz PositionErrorTests.test_allUnsetcCs4tjdd�}|�|j�|�|j�|�|j�dS)z{
        In an empty L{base.PositionError} with invariant testing, all
        dilutions of positions are L{None}.
        T)�
testInvariantNr�r�rrr�test_allUnsetWithInvariantMsz-PositionErrorTests.test_allUnsetWithInvariantcCstjdd�}|�|jd�dS)zN
        L{base.PositionError}s can be instantiated with just a HDOP.
        r)r�N�rr�rr�r�rrr�test_withoutInvariantWsz(PositionErrorTests.test_withoutInvariantcCs tjddd�}|�|jd�dS)zv
        Creating a simple L{base.PositionError} with just a HDOP while
        checking the invariant works.
        rT)r�r�Nr�r�rrr�test_withInvariant^r�z%PositionErrorTests.test_withInvariantcCs>tjdddd�}|�|jd�|�|jd�|�|jd�dS)z�
        Creating a L{base.PositionError} with values set to an impossible
        combination works if the invariant is not checked.
        r)r�r�r�N)rr�rr�r�r�)r�errorrrr�test_invalidWithoutInvariantfsz/PositionErrorTests.test_invalidWithoutInvariantcCs|jttjddddd�dS)z�
        Creating a L{base.PositionError} with values set to an impossible
        combination raises C{ValueError} if the invariant is being tested.
        rT)r�r�r�r�N)rrrr�rrrr�test_invalidWithInvariantps
�z,PositionErrorTests.test_invalidWithInvariantcCs&tjddd�}d|_|�|jd�dS)z}
        You can set the PDOP value to value inconsisted with HDOP and VDOP
        when not checking the invariant.
        r�r�r��Y@N)rr�r�r)r�perrr�test_setDOPWithoutInvariant~sz.PositionErrorTests.test_setDOPWithoutInvariantcCs>tjdddd�}|j}dd�}|�t||�|�|j|�dS)z�
        Attempting to set the PDOP value to value inconsisted with HDOP and
        VDOP when checking the invariant raises C{ValueError}.
        rT)r�r�r�cSs
d|_dS)Nr�)r�)r�rrr�setPDOP�s
z<PositionErrorTests.test_setDOPWithInvariant.<locals>.setPDOPN)rr�r�rrr)rr�r�r�rrr�test_setDOPWithInvariant�s
z+PositionErrorTests.test_setDOPWithInvariantz.<PositionError (pdop: %s, hdop: %s, vdop: %s)>cCsJ|�|j|�|�|j|�|�|j|�|�t|�|j|||f�dS)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)rr�r�r�r
�
REPR_TEMPLATE)rr�r�r�r�rrr�_testDOP�s zPositionErrorTests._testDOPcCs>d\}}|d|dd}tj||d�}|�||||�dS)zF
        The VDOP is correctly determined from PDOP and HDOP.
        �r;r���?)r�r�N�rr�r�)rr�r�r�r�rrr�test_positionAndHorizontalSet��z0PositionErrorTests.test_positionAndHorizontalSetcCs>d\}}|d|dd}tj||d�}|�||||�dS)zF
        The HDOP is correctly determined from PDOP and VDOP.
        r�r�r�)r�r�Nr�)rr�r�r�r�rrr�test_positionAndVerticalSet�r�z.PositionErrorTests.test_positionAndVerticalSetcCs>d\}}|d|dd}tj||d�}|�||||�dS)zF
        The PDOP is correctly determined from HDOP and VDOP.
        )rrr�r�r�Nr�)rr�r�r�r�rrr�test_horizontalAndVerticalSet�r�z0PositionErrorTests.test_horizontalAndVerticalSetN)r r!r"r#r�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�>s


			r�c@s4eZdZdZdd�Zdddd�Zdd�Zd	d
�ZdS)�BeaconInformationTestszB
    Tests for L{twisted.positioning.base.BeaconInformation}.
    cCs2t��}|�t|j�d�d}|�t|�|�dS)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/rrr�test_minimal�s
�z#BeaconInformationTests.test_minimalr]r)�azimuth�	elevation�signalToNoiseRatiocst�fdd�}t�}tdd�D]
}|�||d��qt�|�}��t|j�d���t|j�d���t	|�d�d	S)
zw
        Tests a beacon information with a bunch of satellites, none of
        which used in computing a fix.
        cs$t�j�}|�|�tjdi|��S)Nr)�dict�satelliteKwargs�updater�	Satellite)rC�kwargsrrr�_buildSatellite�s

z;BeaconInformationTests.test_simple.<locals>._buildSatelliter]�
)�
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)
�set�range�addrr�rr��seenBeaconsr�r
)rr�beacons�prnr�rrrr-�s
�z"BeaconInformationTests.test_simplecCs�t��}tdd�D]}tjd	d|i|j��}|j�|�|dr&|j�|�q	|�t	|j�d�|�t	|j�d�|�t
|�d�dS)
zv
        Tests a beacon information with a bunch of satellites, some of
        them used in computing a fix.
        r]rr	r�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)rr�rrrrr
r�rr�r
)rr�r�	satelliterrr�test_someSatellitesUsed�s��z.BeaconInformationTests.test_someSatellitesUsedN)r r!r"r#r�rr-rrrrrr��s
#r�c@� eZdZdZdd�Zdd�ZdS)�PositioningBeaconTestsz.
    Tests for L{base.PositioningBeacon}.
    cCs,t�tj�}|�|�t�tt�d��dS)zX
        Tests that L{base.PositioningBeacon} implements L{IPositioningBeacon}.
        r]N)r�
implementedByr�PositioningBeacon�
assertTruer�verifyObject)r�
implementsrrr�test_interface"s
z%PositioningBeaconTests.test_interfacecCs|�tt�d��d�dS)z9
        Tests the repr of a positioning beacon.
        �Az<Beacon (A)>N)rr
rrrrrrrn*r�z PositioningBeaconTests.test_reprN)r r!r"r#rrnrrrrrsrc@r)�SatelliteTestsz:
    Tests for L{twisted.positioning.base.Satellite}.
    cCsPt�d�}|�|jd�|�|j�|�|j�|�|j�|�t|�d�dS)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.
        r]z:<Satellite (1), azimuth: None, elevation: None, snr: None>N)	rrrr	r(r�rrr
�r�srrrr�6s
�zSatelliteTests.test_minimalcCs^tjddddd�}|�|jd�|�|jd�|�|jd�|�|jd�|�t|�d�dS)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.
        r]g�p@g>@g9@)r	r�rrz;<Satellite (1), azimuth: 270.0, elevation: 30.0, snr: 25.0>N)rrrr	r�rrr
rrrrr-Fs��zSatelliteTests.test_simpleN)r r!r"r#r�r-rrrrr1srN)r#�zope.interfacer�twisted.positioningr�twisted.positioning.baserr� twisted.positioning.ipositioningr�twisted.trial.unittestrr	r$rer�r�r�r�r�r�r�rrrrrr�<module>s*$8L'),	W

Anon7 - 2022
AnonSec Team