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_base.cpython-38.pyc
U


W[�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.
�)�TestCase)�base)�Angles�
Directions)�IPositioningBeacon)�verifyc@s0eZdZdZdd�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.
        �Z	angleTypez<Variation (unknown value)>N)rr
rZ	VARIATIONrrr
rrr�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	r
rrr�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,szAngleTests.test_bogusTypeN)�__name__�
__module__�__qualname__�__doc__rrrrrrrrr
s
			rc@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_simple8s

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!rr)r�heading�expectedReprrrr� test_headingWithoutVariationReprEs
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�$��ZvariationValuez2<Heading ({0} degrees, <Variation ({1} degrees)>)>N)rr!�
fromFloatsrr�format)rZangler%r*ZreprTemplaterrr�test_headingWithVariationReprOsz*HeadingTests.test_headingWithVariationReprcCs|�t�d�t�d��dS)z>
        Headings with the same values compare equal.
        rN)rrr!rrrr�test_valueEqualityZszHeadingTests.test_valueEqualitycCs|�t�d�t�d��dS)zA
        Headings with different values compare unequal.
        r�@N)�assertNotEqualrr!rrrr�test_valueInequalityasz!HeadingTests.test_valueInequalitycCst�d�dS)zR
        Headings can be instantiated with a value of 0 and no variation.
        rN�rr!rrrr�test_zeroHeadingEdgeCasehsz%HeadingTests.test_zeroHeadingEdgeCasecCst�dd�dS)zh
        Headings can be instantiated with a value of 0 and a variation of 180
        degrees.
        r�Nr6rrrr�*test_zeroHeading180DegreeVariationEdgeCaseosz7HeadingTests.test_zeroHeading180DegreeVariationEdgeCasecKs|jttjjf|�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!r/)r�kwrrr�
_badValueTestwszHeadingTests._badValueTestcCs|jdd�dS)zO
        Headings can not be instantiated with a value of 360 degrees.
        g�v@�Z
angleValueN�r;rrrr�test_badAngleValueEdgeCase�sz'HeadingTests.test_badAngleValueEdgeCasecCs|jdd�dS)zT
        Headings can not be instantiated with a variation of -180 degrees.
        ��f�r.Nr=rrrr�test_badVariationEdgeCase�sz&HeadingTests.test_badVariationEdgeCasecCs|jdd�dS)z>
        Negative heading values raise C{ValueError}.
        r-r<Nr=rrrr�test_negativeHeading�sz!HeadingTests.test_negativeHeadingcCs|jdd�dS)zK
        Heading values greater than C{360.0} raise C{ValueError}.
        g w@r<Nr=rrrr�test_headingTooLarge�sz!HeadingTests.test_headingTooLargecCs|jdd�dS)zK
        Variation values less than C{-180.0} raise C{ValueError}.
        g�g�r.Nr=rrrr�test_variationTooNegative�sz&HeadingTests.test_variationTooNegativecCs|jdd�dS)zM
        Variation values greater than C{180.0} raise C{ValueError}.
        g�g@r.Nr=rrrr�test_variationTooPositive�sz&HeadingTests.test_variationTooPositivecCs,tjjddd�}|�|jt�dtj��dS)zQ
        A heading with a value and a variation has a corrected heading.
        rr-r.g&@N�rr!r/rr&r
r�HEADINGr'rrr�test_correctedHeading�sz"HeadingTests.test_correctedHeadingcCs,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 across the 360 degree
        boundary.
        �pv@g�r.rNrEr'rrr�test_correctedHeadingOverflow�sz*HeadingTests.test_correctedHeadingOverflowcCs,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 360
        degree boundary.
        rH��r.�NrEr'rrr�%test_correctedHeadingOverflowEdgeCase�sz2HeadingTests.test_correctedHeadingOverflowEdgeCasecCs,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 under the 0 degree
        boundary.
        rr3r.rHNrEr'rrr�test_correctedHeadingUnderflow�sz+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.
        rr.rKNrEr'rrr�&test_correctedHeadingUnderflowEdgeCase�sz3HeadingTests.test_correctedHeadingUnderflowEdgeCasecCsHtjjddd�}|�d�|�|jjd�|�d�|�|jjd�dS)zK
        Setting the sign of a heading changes the variation sign.
        rr.����rJN)rr!r/�setSignrr%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.
        rr.����r�2N)	rr!r/rrrQrr%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}.
        rrON)	rr!r/r$r%r"rrrQr'rrr�test_setUnknownVariationSign�sz)HeadingTests.test_setUnknownVariationSignN)rrrrr)r,r1r2r5r7r9r;r>r@rArBrCrDrGrIrLrMrNrRrUrVrrrrr 4s.

	



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�
Coordinaterr#�r�
coordinaterrr�
test_floats
zCoordinateTests.test_floatcCs(t�d�}d�d�}|�t|�|�dS)zn
        Coordinates that aren't explicitly latitudes or longitudes have an
        appropriate repr.
        rXz%<Angle of unknown type ({0} degrees)>N)rrYr0rr�rr[r+rrr�	test_repr	s

zCoordinateTests.test_reprcCs,t�dtj�}d�d�}|�t|�|�dS)zU
        Positive latitudes have a repr that specifies their type and value.
        rX�<Latitude ({0} degrees)>N�rrYr�LATITUDEr0rrr]rrr�test_positiveLatitudes
z%CoordinateTests.test_positiveLatitudecCs,t�dtj�}d�d�}|�t|�|�dS)zU
        Negative latitudes have a repr that specifies their type and value.
        �I�r_Nr`r]rrr�test_negativeLatitudes
z%CoordinateTests.test_negativeLatitudecCs,t�dtj�}d�d�}|�t|�|�dS)zV
        Positive longitudes have a repr that specifies their type and value.
        �I@�<Longitude ({0} degrees)>N�rrYr�	LONGITUDEr0rr�rZ	longituder+rrr�test_positiveLongitude%s
z&CoordinateTests.test_positiveLongitudecCs,t�dtj�}d�d�}|�t|�|�dS)zV
        Negative longitudes have a repr that specifies their type and value.
        rcrfNrgrirrr�test_negativeLongitude.s
z&CoordinateTests.test_negativeLongitudecCs|�ttjdd�dS)zM
        Creating coordinates with bogus types rasies C{ValueError}.
        ��b@rN)rrrrYrrrr�test_bogusCoordinateType7sz(CoordinateTests.test_bogusCoordinateTypecCs|�ttjdtj�dS)zm
        Creating coordinates with angle types that aren't coordinates raises
        C{ValueError}.
        rlN)rrrrYrrFrrrr�test_angleTypeNotCoordinate>sz+CoordinateTests.test_angleTypeNotCoordinatecCsdd�}|�|�|��dS)zE
        Coordinates with the same value and type are equal.
        cSst�dtj�S)Nr�rrYrrhrrrr�makeCoordinateJsz5CoordinateTests.test_equality.<locals>.makeCoordinateN)r)rrprrr�
test_equalityFszCoordinateTests.test_equalitycCs$t�d�}t�d�}|�||�dS)zA
        Coordinates with different values aren't equal.
        rrJN)rrYr4�rZc1Zc2rrr�test_differentAnglesInequalityOs

z.CoordinateTests.test_differentAnglesInequalitycCs,t�dtj�}t�dtj�}|�||�dS)zT
        Coordinates with the same values but different types aren't equal.
        rN)rrYrrarhr4rrrrr�test_differentTypesInequalityXsz-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.
        rerOrPrcN)rrYrrarQrr"�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.
        rerSrrTN)	rrYrrarrrQrr")r�valuervrrr�test_badVariationSignmsz%CoordinateTests.test_badVariationSigncCs"t�dtj�}|�|jtj�dS)zD
        Positive latitudes are in the northern hemisphere.
        rN)rrYrrar�
hemisphererZNORTHrZrrr�test_northernHemispheresz'CoordinateTests.test_northernHemispherecCs"t�dtj�}|�|jtj�dS)zD
        Positive longitudes are in the eastern hemisphere.
        rN)rrYrrhrrzrZEASTrZrrr�test_easternHemisphere�sz&CoordinateTests.test_easternHemispherecCs"t�dtj�}|�|jtj�dS)zD
        Negative latitudes are in the southern hemisphere.
        rJN)rrYrrarrzrZSOUTHrZrrr�test_southernHemisphere�sz'CoordinateTests.test_southernHemispherecCs"t�dtj�}|�|jtj�dS)zD
        Negative longitudes are in the western hemisphere.
        rJN)rrYrrhrrzrZWESTrZrrr�test_westernHemisphere�sz&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)rzr�r[rr�<lambda>��z4CoordinateTests.test_badHemisphere.<locals>.<lambda>)rrYrrrrr�r�test_badHemisphere�sz"CoordinateTests.test_badHemispherecCs |�ttd�|�ttd�dS)zt
        Creating a latitude with a value greater than or equal to 90 degrees
        raises C{ValueError}.
        rlg�V@N�rr�
_makeLatituderrrr�test_latitudeTooLarge�sz%CoordinateTests.test_latitudeTooLargecCs |�ttd�|�ttd�dS)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�sz%CoordinateTests.test_latitudeTooSmallcCs |�ttd�|�ttd�dS)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�sz&CoordinateTests.test_longitudeTooLargecCs |�ttd�|�ttd�dS)zt
        Creating a longitude with a value less than or equal to -180 degrees
        raises C{ValueError}.
        g@o�r?Nr�rrrr�test_longitudeTooSmall�sz&CoordinateTests.test_longitudeTooSmallcCs<t�dtj�}|�|jd�t�dtj�}|�|jd�dS)zQ
        Coordinate values can be accessed in degrees, minutes, seconds.
        g@I@)rT�rg%��CI@)rT��.N)rrYrrar�inDegreesMinutesSecondsrurrr�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)rrYr$r�rurrr�(test_unknownAngleInDegreesMinutesSeconds�sz8CoordinateTests.test_unknownAngleInDegreesMinutesSecondsN)rrrr\r^rbrdrjrkrmrnrqrsrtrwryr{r|r}r~r�r�r�r�r�r�r�rrrrrWs0
												rWcCst�|tj�S)z7
    Builds and returns a latitude of given value.
    )rrYrra�rxrrrr��sr�cCst�|tj�S)z8
    Builds and returns a longitude of given value.
    ror�rrrr��sr�c@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�
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�Altituderr#ZinMetersZinFeetZMETERS_PER_FOOT�rZaltituderrr�
test_value�s
zAltitudeTests.test_valuecCst�d�}|�t|�d�dS)zF
        Altitudes report their type and value in their repr.
        rz<Altitude (1.0 m)>N)rr�rrr�rrrr^s
zAltitudeTests.test_reprcCs$t�d�}t�d�}|�||�dS)z<
        Altitudes with equal values compare equal.
        rN)rr�r�rZ
firstAltitudeZsecondAltituderrrrqs

zAltitudeTests.test_equalitycCs$t�d�}t�d�}|�||�dS)zF
        Altitudes with different values don't compare equal.
        rrJN)rr�r4r�rrr�test_inequalitys

zAltitudeTests.test_inequalityN)rrrrr�r^rqr�rrrrr��s
	r�c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
SpeedTestsz@
    Tests for the L{twisted.positioning.base.Speed} class.
    cCs,t�d�}|�|jd�|�t|�d�dS)��
        Speeds can be instantiated, and report their value in meters
        per second, and can be converted to floats.
        reN)r�Speedr�inMetersPerSecondr#�rZspeedrrrr�s
zSpeedTests.test_valuecCst�d�}|�t|�d�dS)zC
        Speeds report their type and value in their repr.
        rez<Speed (50.0 m/s)>N)rr�rrr�rrrr^)s
zSpeedTests.test_reprcCs|�ttjd�dS)zA
        Creating a negative speed raises C{ValueError}.
        rJN)rrrr�rrrr�test_negativeSpeeds1szSpeedTests.test_negativeSpeedscCs"t�d�}|�dtj|j�dS)zC
        A speed can be converted into its value in knots.
        rrON)rr�r�MPS_PER_KNOT�inKnotsr�rrr�test_inKnots8s
zSpeedTests.test_inKnotscCs|�dtt�d���dS)z;
        A speed can be converted into a C{float}.
        rN)rr#rr�rrrr�test_asFloat@szSpeedTests.test_asFloatN)	rrrrr�r^r�r�r�rrrrr�s
r�c@s8eZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�ZdS)
�
ClimbTestsz6
    Tests for L{twisted.positioning.base.Climb}.
    cCs,t�d�}|�|jd�|�t|�d�dS)r��E@N�r�Climbrr�r#�rZclimbrrrr)Ls
zClimbTests.test_simplecCst�d�}|�t|�d�dS)zC
        Climbs report their type and value in their repr.
        r�z<Climb (42.0 m/s)>N)rr�rrr�rrrr^Vs
zClimbTests.test_reprcCs,t�d�}|�|jd�|�t|�d�dS)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^s
zClimbTests.test_negativeClimbscCs"t�d�}|�dtj|j�dS)zC
        A climb can be converted into its value in knots.
        rrON)rr�rr�r�r�rrr�test_speedInKnotshs
zClimbTests.test_speedInKnotscCs|�dtt�d���dS)z;
        A climb can be converted into a C{float}.
        rN)rr#rr�rrrrr�pszClimbTests.test_asFloatN)	rrrrr)r^r�r�r�rrrrr�Hs

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�rZ
positionErrorrrr�
test_allUnset|s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_allUnsetWithInvariant�sz-PositionErrorTests.test_allUnsetWithInvariantcCstjdd�}|�|jd�dS)zN
        L{base.PositionError}s can be instantiated with just a HDOP.
        r)r�N�rr�rr�r�rrr�test_withoutInvariant�s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�sz%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�rr�r�r�)r�errorrrr�test_invalidWithoutInvariant�sz/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_invalidWithInvariant�s
�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�sz<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)rr�r�r�r�
REPR_TEMPLATE)rr�r�r�r�rrr�_testDOP�szPositionErrorTests._testDOPcCs>d\}}|d|dd}tj||d�}|�||||�dS)zF
        The VDOP is correctly determined from PDOP and HDOP.
        �r3r���?)r�r�N�rr�r�)rr�r�r�r�rrr�test_positionAndHorizontalSet�sz0PositionErrorTests.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�sz.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�sz0PositionErrorTests.test_horizontalAndVerticalSetN)rrrrr�r�r�r�r�r�r�r�r�r�r�r�r�rrrrr�xs		


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
sz#BeaconInformationTests.test_minimalrOr)�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�}|�|�tjf|�Sr)�dict�satelliteKwargs�updater�	Satellite)r:�kwargsrrr�_buildSatellite s

z;BeaconInformationTests.test_simple.<locals>._buildSatelliterO�
)�
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�rr��seenBeaconsr�r)rr�Zbeacons�prnr�rrrr)s

�z"BeaconInformationTests.test_simplecCs�t��}tdd�D]:}tjfd|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.
        rOr�r�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>])>N)rr�r�r�r�r�r�r�rr�r)rr�r�Z	satelliterrr�test_someSatellitesUsed<s
�z.BeaconInformationTests.test_someSatellitesUsedN)rrrrr�r�r)r�rrrrr�s
!r�c@s 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}.
        rON)rZ
implementedByr�PositioningBeaconZ
assertTruerZverifyObject)rZ
implementsrrr�test_interface_s
z%PositioningBeaconTests.test_interfacecCs|�tt�d��d�dS)z9
        Tests the repr of a positioning beacon.
        �Az<Beacon (A)>N)rrrr�rrrrr^hsz PositioningBeaconTests.test_reprN)rrrrr�r^rrrrr�[s	r�c@s eZdZdZdd�Zdd�ZdS)�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.
        rOz:<Satellite (1), azimuth: None, elevation: None, snr: None>N)	rr�rr�r$r�r�r�r�r�srrrr�ts
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.
        rOg�p@g>@g9@)r�r�r�r�z;<Satellite (1), azimuth: 270.0, elevation: 30.0, snr: 25.0>N)rr�rr�r�r�r�rr�rrrr)�s�zSatelliteTests.test_simpleN)rrrrr�r)rrrrr�psr�N)rZtwisted.trial.unittestrZtwisted.positioningrZtwisted.positioning.baserrZ twisted.positioning.ipositioningrZzope.interfacerrr rWr�r�r�r�r�r�r�r�r�rrrr�<module>s('Mb*-0U