+
    Dfj\t                    J   R t ^ RIHt ^ RIHt ^ RIHt ^ RIHtH	t	 ^ RI
Ht ^ RIHt  ! R R]4      t ! R	 R
]4      t ! R R]4      tR R ltR R lt ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      tR# ) z(
Test cases for positioning primitives.
)annotations)verify)base)Angles
Directions)IPositioningBeacon)TestCasec                  J    ] tR t^tRtR R ltR R ltR R ltR R	 ltR
t	R# )
AngleTestsz8
Tests for the L{twisted.positioning.base.Angle} class.
c                   V ^8  d   QhRR/#    returnNone )formats   "D/usr/lib/python3/dist-packages/twisted/positioning/test/test_base.py__annotate__AngleTests.__annotate__   s     M MD M    c                f    \         P                  ! 4       pV P                  R\        V4      4       R# )zL
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   & r   
test_emptyAngleTests.test_empty   s$    
 JJLBDGLr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     A A Ar   c                    \         P                  ! \        P                  R7      pV P	                  R\        V4      4       R# )zN
The repr of an empty variation says that it is a variation of unknown
value.
	angleTypez<Variation (unknown value)>N)r   r   r   	VARIATIONr   r   r   s   & r   test_variationAngleTests.test_variation   s-    
 JJ!1!126Q@r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   %   s     K K$ Kr   c                h    \         P                  ! R4      pV P                  R\        V4      4       R# )zb
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   s   & r   test_unknownTypeAngleTests.test_unknownType%   s&    
 JJsO@$q'Jr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   -   s     E E Er   c                R    V P                  \        \        P                  RR7       R# )zC
Trying to create an angle with a bogus type raises C{ValueError}.
BOGUSr"   N)assertRaises
ValueErrorr   r   r   s   &r   test_bogusTypeAngleTests.test_bogusType-   s     	*djjGDr   r   N)
__name__
__module____qualname____firstlineno____doc__r   r%   r*   r2   __static_attributes__r   r   r   r
   r
      s%    MAKE Er   r
   c                  "   ] tR t^4tRtR R ltR R ltR R ltR R	 ltR
 R lt	R R lt
R R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR  R! ltR" R# ltR$ R% ltR& R' ltR( R) ltR* R+ ltR, R- ltR.tR/# )0HeadingTestsz:
Tests for the L{twisted.positioning.base.Heading} class.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   HeadingTests.__annotate__9   s     
. 
.T 
.r   c                   \         P                  ! R4      pV P                  VP                  R4       V P                  \	        V4      R4       V P                  VP                  4       V P                  VP                  4       R# )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}.
r)   N)r   Headingr   inDecimalDegreesfloatassertIsNone	variationcorrectedHeadingr   hs   & r   test_simpleHeadingTests.test_simple9   sb     LL++S1q3'!++&!,,-r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=   E   s     6 6$ 6r   c                l    \         P                  ! R4      pRpV P                  \        V4      V4       R# )z\
A repr of a heading with no variation reports its value and that the
variation is unknown.
r)   z*<Heading (1.0 degrees, unknown variation)>N)r   r?   r   r   )r   headingexpectedReprs   &  r    test_headingWithoutVariationRepr-HeadingTests.test_headingWithoutVariationReprE   s+    
 ,,s#Cg5r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=   N   s     O Ot Or   c                    RRr!\         P                  P                  WR7      pRpV P                  \	        V4      VP                  W4      4       R# )z]
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      $)r   r?   
fromFloatsr   r   r   )r   anglerC   rK   reprTemplates   &    r   test_headingWithVariationRepr*HeadingTests.test_headingWithVariationReprN   sF    
 y,,))%)JKg(;(;E(MNr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=   X   s     ? ?D ?r   c                z    V P                  \        P                  ! R4      \        P                  ! R4      4       R# )z.
Headings with the same values compare equal.
r)   N)r   r   r?   r1   s   &r   test_valueEqualityHeadingTests.test_valueEqualityX   s&     	c*DLL,=>r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=   ^   s     B Bd Br   c                z    V P                  \        P                  ! R4      \        P                  ! R4      4       R# )z1
Headings with different values compare unequal.
r)          @N)assertNotEqualr   r?   r1   s   &r   test_valueInequality!HeadingTests.test_valueInequality^   s&     	DLL-t||C/@Ar   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=   d   s      $ r   c                2    \         P                  ! ^ 4       R# )zB
Headings can be instantiated with a value of 0 and no variation.
Nr   r?   r1   s   &r   test_zeroHeadingEdgeCase%HeadingTests.test_zeroHeadingEdgeCased   s     	Qr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=   j   s      D r   c                4    \         P                  ! ^ ^4       R# )zP
Headings can be instantiated with a value of 0 and a variation of 180
degrees.
Nre   r1   s   &r   *test_zeroHeading180DegreeVariationEdgeCase7HeadingTests.test_zeroHeading180DegreeVariationEdgeCasej   s    
 	Qr   c                    V ^8  d   QhRRRR/# )r   kwrA   r   r   r   )r   s   "r   r   r=   q   s     E E% ED Er   c                f    V P                   ! \        \        P                  P                  3/ VB  R# )z
Helper function for verifying that bad values raise C{ValueError}.

@param kw: The keyword arguments passed to L{base.Heading.fromFloats}.
N)r/   r0   r   r?   rT   )r   rm   s   &,r   _badValueTestHeadingTests._badValueTestq   s#     	*dll&=&=DDr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=   y   s     - -D -r   c                *    V P                  RR7       R# )z?
Headings can not be instantiated with a value of 360 degrees.
g     v@
angleValueNro   r1   s   &r   test_badAngleValueEdgeCase'HeadingTests.test_badAngleValueEdgeCasey        	e,r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=           2 24 2r   c                *    V P                  RR7       R# )zD
Headings can not be instantiated with a variation of -180 degrees.
rQ   N     fru   r1   s   &r   test_badVariationEdgeCase&HeadingTests.test_badVariationEdgeCase        	&1r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=           - -d -r   c                *    V P                  RR7       R# )z.
Negative heading values raise C{ValueError}.
rs   NrS   ru   r1   s   &r   test_negativeHeading!HeadingTests.test_negativeHeading   rx   r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      r   r   c                *    V P                  RR7       R# )z;
Heading values greater than C{360.0} raise C{ValueError}.
g      w@rs   Nru   r1   s   &r   test_headingTooLarge!HeadingTests.test_headingTooLarge   rx   r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      rz   r   c                *    V P                  RR7       R# )z;
Variation values less than C{-180.0} raise C{ValueError}.
rQ   Ng     gru   r1   s   &r   test_variationTooNegative&HeadingTests.test_variationTooNegative   r   r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     1 14 1r   c                *    V P                  RR7       R# )z=
Variation values greater than C{180.0} raise C{ValueError}.
g     g@rQ   Nru   r1   s   &r   test_variationTooPositive&HeadingTests.test_variationTooPositive   s     	%0r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     O Ot Or   c                    \         P                  P                  RRR7      pV P                  VP                  \         P
                  ! R\        P                  4      4       R# )zA
A heading with a value and a variation has a corrected heading.
r)   rQ   g      &@NrS   r   r?   rT   r   rD   r   r   HEADINGrE   s   & r   test_correctedHeading"HeadingTests.test_correctedHeading   sB     LL##C#>++TZZfnn-MNr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     N Nt Nr   c                    \         P                  P                  RRR7      pV P                  VP                  \         P
                  ! R\        P                  4      4       R# )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@rQ   r)   Ng       r   rE   s   & r   test_correctedHeadingOverflow*HeadingTests.test_correctedHeadingOverflow   B     LL##E$#?++TZZV^^-LMr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     N Nt Nr   c                    \         P                  P                  RRR7      pV P                  VP                  \         P
                  ! R\        P                  4      4       R# )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.
r   rQ           N      r   rE   s   & r   %test_correctedHeadingOverflowEdgeCase2HeadingTests.test_correctedHeadingOverflowEdgeCase   r   r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     P P Pr   c                    \         P                  P                  RRR7      pV P                  VP                  \         P
                  ! R\        P                  4      4       R# )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.
r)   r_   rQ   r   Nr   rE   s   & r   test_correctedHeadingUnderflow+HeadingTests.test_correctedHeadingUnderflow   sB     LL##C#<++TZZv~~-NOr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     N N Nr   c                    \         P                  P                  RRR7      pV P                  VP                  \         P
                  ! R\        P                  4      4       R# )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.
r)   rQ   r   Nr   rE   s   & r   &test_correctedHeadingUnderflowEdgeCase3HeadingTests.test_correctedHeadingUnderflowEdgeCase   sB     LL##C#<++TZZV^^-LMr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     = =t =r   c                $   \         P                  P                  RRR7      pVP                  ^4       V P	                  VP
                  P                  R4       VP                  R4       V P	                  VP
                  P                  R4       R# )z;
Setting the sign of a heading changes the variation sign.
r)   rQ   Nr   )r   r?   rT   setSignr   rC   r@   rE   s   & r   test_setVariationSign"HeadingTests.test_setVariationSign   sg     LL##C#<			!55s;			"55t<r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     < <$ <r   c                   \         P                  P                  RRR7      pV P                  \        VP
                  R4       V P                  VP                  P                  R4       V P                  \        VP
                  ^ 4       V P                  VP                  P                  R4       V P                  \        VP
                  ^24       V P                  VP                  P                  R4       R# )zy
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.
r)   rQ   N)	r   r?   rT   r/   r0   r   r   rC   r@   rE   s   & r   test_setBadVariationSign%HeadingTests.test_setBadVariationSign   s    
 LL##C#<*aii555s;*aii355s;*aii455s;r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r=      s     4 4d 4r   c                    \         P                  P                  R4      pV P                  VP                  P
                  4       V P                  \        VP                  ^4       R# )zL
Setting the sign on a heading with unknown variation raises
C{ValueError}.
r)   N)	r   r?   rT   rB   rC   r@   r/   r0   r   rE   s   & r   test_setUnknownVariationSign)HeadingTests.test_setUnknownVariationSign   sF    
 LL##C(!++667*aii3r   r   N)r4   r5   r6   r7   r8   rG   rM   rW   r[   ra   rf   rj   ro   rv   r}   r   r   r   r   r   r   r   r   r   r   r   r   r9   r   r   r   r;   r;   4   s    
.6O?BE-2--21ONNPN=<4 4r   r;   c                  6   ] tR t^tR R ltR R ltR R ltR R ltR	 R
 ltR R lt	R R lt
R R ltR R ltR R ltR R ltR R ltR R ltR R ltR R ltR R  ltR! R" ltR# R$ ltR% R& ltR' R( ltR) R* ltR+ R, ltR- R. ltR/ R0 ltR1tR2# )3CoordinateTestsc                   V ^8  d   QhRR/# r   r   )r   s   "r   r   CoordinateTests.__annotate__   s     2 2D 2r   c                h    \         P                  ! R4      pV P                  \        V4      R4       R# )z)
Coordinates can be converted to floats.
      $@N)r   
Coordinater   rA   r   
coordinates   & r   
test_floatCoordinateTests.test_float   s'     __T*
z*D1r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r      s     9 94 9r   c                t    \         P                  ! R4      pRR R2pV P                  \        V4      V4       R# )zV
Coordinates that aren't explicitly latitudes or longitudes have an
appropriate repr.
r   z<Angle of unknown type (
 degrees)>N)r   r   r   r   r   r   rL   s   &  r   	test_reprCoordinateTests.test_repr   s5    
 __T*
1$zBj)<8r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r           9 9t 9r   c                    \         P                  ! R\        P                  4      pRR R2pV P	                  \        V4      V4       R# )zE
Positive latitudes have a repr that specifies their type and value.
r   <Latitude (r   Nr   r   r   LATITUDEr   r   r   s   &  r   test_positiveLatitude%CoordinateTests.test_positiveLatitude   s;     __T6??;
$TF*5j)<8r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     r   r   c                    \         P                  ! R\        P                  4      pRR R2pV P	                  \        V4      V4       R# )zE
Negative latitudes have a repr that specifies their type and value.
r   r   N      Ir   r   s   &  r   test_negativeLatitude%CoordinateTests.test_negativeLatitude  s;     __UFOO<
$UG:6j)<8r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r          8 8 8r   c                    \         P                  ! R\        P                  4      pRR R2pV P	                  \        V4      V4       R# )zF
Positive longitudes have a repr that specifies their type and value.
      I@<Longitude (r   Nr   r   r   	LONGITUDEr   r   r   	longituderL   s   &  r   test_positiveLongitude&CoordinateTests.test_positiveLongitude  s<     OOD&*:*:;	%dV:6i,7r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     r   r   c                    \         P                  ! R\        P                  4      pRR R2pV P	                  \        V4      V4       R# )zF
Negative longitudes have a repr that specifies their type and value.
r   r   Nr   r   r   s   &  r   test_negativeLongitude&CoordinateTests.test_negativeLongitude  s<     OOE6+;+;<	%eWJ7i,7r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     G G$ Gr   c                R    V P                  \        \        P                  RR4       R# )z=
Creating coordinates with bogus types rasies C{ValueError}.
     b@r.   N)r/   r0   r   r   r1   s   &r   test_bogusCoordinateType(CoordinateTests.test_bogusCoordinateType  s     	*doougFr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   "  s     N NT Nr   c                n    V P                  \        \        P                  R\        P
                  4       R# )zU
Creating coordinates with angle types that aren't coordinates raises
C{ValueError}.
r   N)r/   r0   r   r   r   r   r1   s   &r   test_angleTypeNotCoordinate+CoordinateTests.test_angleTypeNotCoordinate"  s     
 	*dooufnnMr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   )  s     = =t =r   c                J    R R lpV P                  V! 4       V! 4       4       R# )z5
Coordinates with the same value and type are equal.
c                   V ^8  d   QhRR/# )r   r   base.Coordinater   )r   s   "r   r   3CoordinateTests.test_equality.<locals>.__annotate__.  s     	: 	: 	:r   c                 L    \         P                  ! R \        P                  4      # )r)   r   r   r   r   r   r   r   makeCoordinate5CoordinateTests.test_equality.<locals>.makeCoordinate.  s    ??3(8(899r   N)r   )r   r   s   & r   test_equalityCoordinateTests.test_equality)  s    
	: 	)>+;<r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   3  s     $ $ $r   c                    \         P                  ! R4      p\         P                  ! R4      pV P                  W4       R# )z1
Coordinates with different values aren't equal.
r)   Nr   )r   r   r`   r   c1c2s   &  r   test_differentAnglesInequality.CoordinateTests.test_differentAnglesInequality3  s.     __S!__T"B#r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   ;  s     $ $t $r   c                    \         P                  ! R\        P                  4      p\         P                  ! R\        P                  4      pV P                  W4       R# )zD
Coordinates with the same values but different types aren't equal.
r)   N)r   r   r   r   r   r`   r   s   &  r   test_differentTypesInequality-CoordinateTests.test_differentTypesInequality;  s<     __S&//2__S&"2"23B#r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   C  s     	4 	44 	4r   c                   \         P                  ! R\        P                  4      pVP	                  ^4       V P                  VP                  R4       VP	                  R4       V P                  VP                  R4       R# )zP
Setting the sign on a coordinate sets the sign of the value of the
coordinate.
r   Nr   r   )r   r   r   r   r   r   r@   r   cs   & r   	test_signCoordinateTests.test_signC  sZ    
 OOD&//2			!++T2			"++U3r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   N  s     3 3t 3r   c                   Rp\         P                  ! V\        P                  4      pV P	                  \
        VP                  R4       V P                  VP                  R4       V P	                  \
        VP                  ^ 4       V P                  VP                  R4       V P	                  \
        VP                  ^24       V P                  VP                  R4       R# )zr
Setting a bogus sign value (not -1 or 1) on a coordinate raises
C{ValueError} and doesn't affect the coordinate.
r   Nr   )	r   r   r   r   r/   r0   r   r   r@   )r   valuer	  s   &  r   test_badVariationSign%CoordinateTests.test_badVariationSignN  s    
 OOE6??3*aii5++T2*aii3++T2*aii4++T2r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   _       B B Br   c                    \         P                  ! R\        P                  4      pV P	                  VP
                  \        P                  4       R# )z4
Positive latitudes are in the northern hemisphere.
r)   N)r   r   r   r   r   
hemispherer   NORTHr   s   & r   test_northernHemisphere'CoordinateTests.test_northernHemisphere_  s4     __S&//:
..
0@0@Ar   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   f       A A Ar   c                    \         P                  ! R\        P                  4      pV P	                  VP
                  \        P                  4       R# )z4
Positive longitudes are in the eastern hemisphere.
r)   N)r   r   r   r   r   r  r   EASTr   s   & r   test_easternHemisphere&CoordinateTests.test_easternHemispheref  s4     __S&*:*:;
..
@r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   m  r  r   c                    \         P                  ! R\        P                  4      pV P	                  VP
                  \        P                  4       R# )z4
Negative latitudes are in the southern hemisphere.
Nr   )r   r   r   r   r   r  r   SOUTHr   s   & r   test_southernHemisphere'CoordinateTests.test_southernHemispherem  s4     __T6??;
..
0@0@Ar   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   t  r  r   c                    \         P                  ! R\        P                  4      pV P	                  VP
                  \        P                  4       R# )z4
Negative longitudes are in the western hemisphere.
Nr   )r   r   r   r   r   r  r   WESTr   s   & r   test_westernHemisphere&CoordinateTests.test_westernHemispheret  s4     __T6+;+;<
..
@r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r   {  s     E ED Er   c                j   a \         P                  ! RR4      oV P                  \        V3R l4       R# )zW
Accessing the hemisphere for a coordinate that can't compute it
raises C{ValueError}.
r)   Nc                    < S P                   # )N)r  )r   s   r   <lambda>4CoordinateTests.test_badHemisphere.<locals>.<lambda>  s    j.C.Cr   )r   r   r/   r0   r   s   &@r   test_badHemisphere"CoordinateTests.test_badHemisphere{  s&    
 __S$/
*&CDr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     ; ;t ;r   c                r    V P                  \        \        R4       V P                  \        \        R4       R# )z\
Creating a latitude with a value greater than or equal to 90 degrees
raises C{ValueError}.
r   g     V@Nr/   r0   _makeLatituder1   s   &r   test_latitudeTooLarge%CoordinateTests.test_latitudeTooLarge  s(    
 	*mU;*mT:r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     < <t <r   c                r    V P                  \        \        R4       V P                  \        \        R4       R# )zZ
Creating a latitude with a value less than or equal to -90 degrees
raises C{ValueError}.
Ng     bg     Vr1  r1   s   &r   test_latitudeTooSmall%CoordinateTests.test_latitudeTooSmall  s(    
 	*mV<*mU;r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     = = =r   c                r    V P                  \        \        R4       V P                  \        \        R4       R# )z^
Creating a longitude with a value greater than or equal to 180 degrees
raises C{ValueError}.
g     @o@g     f@Nr/   r0   _makeLongituder1   s   &r   test_longitudeTooLarge&CoordinateTests.test_longitudeTooLarge  s(    
 	*ne<*ne<r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     > > >r   c                r    V P                  \        \        R4       V P                  \        \        R4       R# )z\
Creating a longitude with a value less than or equal to -180 degrees
raises C{ValueError}.
Ng     @or|   r;  r1   s   &r   test_longitudeTooSmall&CoordinateTests.test_longitudeTooSmall  s(    
 	*nf=*nf=r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     B Bd Br   c                
   \         P                  ! R\        P                  4      pV P	                  VP
                  R4       \         P                  ! R\        P                  4      pV P	                  VP
                  R4       R# )zA
Coordinate values can be accessed in degrees, minutes, seconds.
g     @I@g%CI@N)2          )rE     .   )r   r   r   r   r   inDegreesMinutesSecondsr  s   & r   test_inDegreesMinutesSeconds,CoordinateTests.test_inDegreesMinutesSeconds  sX     OOD&//222K@OOFFOO422LAr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r     s     5 5$ 5r   c                j    \         P                  ! RR4      pV P                  VP                  4       R# )zb
If the vaue of a coordinate is L{None}, its values in degrees,
minutes, seconds is also L{None}.
N)r   r   rB   rJ  r  s   & r   (test_unknownAngleInDegreesMinutesSeconds8CoordinateTests.test_unknownAngleInDegreesMinutesSeconds  s(    
 OOD$'!334r   r   N)r4   r5   r6   r7   r   r   r   r   r   r   r   r   r   r   r  r
  r  r  r  r!  r&  r-  r3  r7  r=  rA  rK  rO  r9   r   r   r   r   r      s    299988GN=$$	43"BABAE;<=>B5 5r   r   c                    V ^8  d   QhRRRR/# r   r  rA   r   r   r   )r   s   "r   r   r     s     3 3 3? 3r   c                L    \         P                  ! V \        P                  4      # )z/
Builds and returns a latitude of given value.
)r   r   r   r   r  s   &r   r2  r2    s     ??5&//22r   c                    V ^8  d   QhRRRR/# rR  r   )r   s   "r   r   r     s     4 4% 4O 4r   c                L    \         P                  ! V \        P                  4      # )z0
Builds and returns a longitude of given value.
r   rT  s   &r   r<  r<    s     ??5&"2"233r   c                  J    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltRt	R# )AltitudeTestsi  z;
Tests for the L{twisted.positioning.base.Altitude} class.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   AltitudeTests.__annotate__  s     F FD Fr   c                   \         P                  ! R4      pV P                  \        V4      R4       V P                  VP                  R4       V P                  VP
                  R\         P                  ,          4       R# )zu
Altitudes can be instantiated and reports the correct value in
meters and feet, as well as when converted to float.
r)   N)r   Altituder   rA   inMetersinFeetMETERS_PER_FOOTr   altitudes   & r   
test_valueAltitudeTests.test_value  s[    
 ==%x#.**C0#0D0D*DEr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rZ    s     ? ?4 ?r   c                h    \         P                  ! R4      pV P                  \        V4      R4       R# )z6
Altitudes report their type and value in their repr.
r)   z<Altitude (1.0 m)>N)r   r\  r   r   r`  s   & r   r   AltitudeTests.test_repr  s'     ==%h)=>r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rZ    s     8 8t 8r   c                    \         P                  ! R4      p\         P                  ! R4      pV P                  W4       R# )z,
Altitudes with equal values compare equal.
r)   N)r   r\  r   r   firstAltitudesecondAltitudes   &  r   r   AltitudeTests.test_equality  s.     c*s+7r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rZ    s     ; ; ;r   c                    \         P                  ! R4      p\         P                  ! R4      pV P                  W4       R# )z6
Altitudes with different values don't compare equal.
r)   Nr   )r   r\  r`   ri  s   &  r   test_inequalityAltitudeTests.test_inequality  s.     c*t,M:r   r   N)
r4   r5   r6   r7   r8   rb  r   r   ro  r9   r   r   r   rX  rX    s!    F?8; ;r   rX  c                  V    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltR R lt	Rt
R# )
SpeedTestsi  z8
Tests for the L{twisted.positioning.base.Speed} class.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   SpeedTests.__annotate__  s     - -D -r   c                    \         P                  ! R4      pV P                  VP                  R4       V P                  \	        V4      R4       R# )j
Speeds can be instantiated, and report their value in meters
per second, and can be converted to floats.
r   N)r   Speedr   inMetersPerSecondrA   r   speeds   & r   rb  SpeedTests.test_value  <    
 

4 00$7ut,r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rt         < <4 <r   c                h    \         P                  ! R4      pV P                  \        V4      R4       R# )z3
Speeds report their type and value in their repr.
r   z<Speed (50.0 m/s)>N)r   rw  r   r   ry  s   & r   r   SpeedTests.test_repr  '     

4 e&:;r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rt     s     8 8T 8r   c                P    V P                  \        \        P                  R4       R# )z1
Creating a negative speed raises C{ValueError}.
Nr   )r/   r0   r   rw  r1   s   &r   test_negativeSpeedsSpeedTests.test_negativeSpeeds   s     	*djj$7r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rt    s     ? ?d ?r   c                    \         P                  ! R4      pV P                  ^\         P                  ,          VP                  4       R# )z3
A speed can be converted into its value in knots.
r)   N)r   rw  r   MPS_PER_KNOTinKnotsry  s   & r   test_inKnotsSpeedTests.test_inKnots  0     

3T...>r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   rt         6 6d 6r   c                d    V P                  R\        \        P                  ! R4      4      4       R# )z+
A speed can be converted into a C{float}.
r)   N)r   rA   r   rw  r1   s   &r   test_asFloatSpeedTests.test_asFloat  !     	eDJJsO45r   r   N)r4   r5   r6   r7   r8   rb  r   r  r  r  r9   r   r   r   rr  rr    s%    -<8?6 6r   rr  c                  V    ] tR tRtRtR R ltR R ltR R ltR	 R
 ltR R lt	Rt
R# )
ClimbTestsi  z.
Tests for L{twisted.positioning.base.Climb}.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   ClimbTests.__annotate__  s     - -T -r   c                    \         P                  ! R4      pV P                  VP                  R4       V P                  \	        V4      R4       R# )rv        E@Nr   Climbr   rx  rA   r   climbs   & r   rG   ClimbTests.test_simple  r|  r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  "  r~  r   c                h    \         P                  ! R4      pV P                  \        V4      R4       R# )z3
Climbs report their type and value in their repr.
r  z<Climb (42.0 m/s)>N)r   r  r   r   r  s   & r   r   ClimbTests.test_repr"  r  r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  )  s     . .T .r   c                    \         P                  ! R4      pV P                  VP                  R4       V P                  \	        V4      R4       R# )zq
Climbs can have negative values, and still report that value
in meters per second and when converted to floats.
Ng      Er  r  s   & r   test_negativeClimbsClimbTests.test_negativeClimbs)  s<    
 

5!00%8uu-r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  2  s     ? ?4 ?r   c                    \         P                  ! R4      pV P                  ^\         P                  ,          VP                  4       R# )z3
A climb can be converted into its value in knots.
r)   N)r   r  r   r  r  r  s   & r   test_speedInKnotsClimbTests.test_speedInKnots2  r  r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  9  r  r   c                d    V P                  R\        \        P                  ! R4      4      4       R# )z+
A climb can be converted into a C{float}.
r)   N)r   rA   r   r  r1   s   &r   r  ClimbTests.test_asFloat9  r  r   r   N)r4   r5   r6   r7   r8   rG   r   r  r  r  r9   r   r   r   r  r    s%    -<.?6 6r   r  c                      ] tR tRtRtR R ltR R ltR R ltR	 R
 ltR R lt	R R lt
R R ltR R ltRtR R ltR R ltR R ltR R ltRtR# )PositionErrorTestsi@  z6
Tests for L{twisted.positioning.base.PositionError}.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   PositionErrorTests.__annotate__E  s     . .t .r   c                    \         P                  ! 4       pV P                  VP                  4       V P                  VP                  4       V P                  VP
                  4       R# )zf
In an empty L{base.PositionError} with no invariant testing, all
dilutions of positions are L{None}.
Nr   PositionErrorrB   pdophdopvdopr   positionErrors   & r   test_allUnset PositionErrorTests.test_allUnsetE  sN    
 **,-,,--,,--,,-r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  O  s     . .D .r   c                    \         P                  ! RR7      pV P                  VP                  4       V P                  VP                  4       V P                  VP
                  4       R# )zc
In an empty L{base.PositionError} with invariant testing, all
dilutions of positions are L{None}.
T)testInvariantNr  r  s   & r   test_allUnsetWithInvariant-PositionErrorTests.test_allUnsetWithInvariantO  sP    
 **>-,,--,,--,,-r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  Y  s     2 2t 2r   c                l    \         P                  ! RR7      pV P                  VP                  R4       R# )z>
L{base.PositionError}s can be instantiated with just a HDOP.
r)   )r  Nr   r  r   r  r  s   & r   test_withoutInvariant(PositionErrorTests.test_withoutInvariantY  s*     **4++S1r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  `  s     2 2D 2r   c                n    \         P                  ! RRR7      pV P                  VP                  R4       R# )z^
Creating a simple L{base.PositionError} with just a HDOP while
checking the invariant works.
r)   T)r  r  Nr  r  s   & r   test_withInvariant%PositionErrorTests.test_withInvariant`  s,    
 **4H++S1r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  h  s     * *d *r   c                    \         P                  ! RRRR7      pV P                  VP                  R4       V P                  VP                  R4       V P                  VP
                  R4       R# )zv
Creating a L{base.PositionError} with values set to an impossible
combination works if the invariant is not checked.
r)   )r  r  r  N)r   r  r   r  r  r  )r   errors   & r   test_invalidWithoutInvariant/PositionErrorTests.test_invalidWithoutInvarianth  sT    
 ""#C@S)S)S)r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r  r  s     
 
4 
r   c           	     X    V P                  \        \        P                  RRRRR7       R# )z
Creating a L{base.PositionError} with values set to an impossible
combination raises C{ValueError} if the invariant is being tested.
r)   T)r  r  r  r  N)r/   r0   r   r  r1   s   &r   test_invalidWithInvariant,PositionErrorTests.test_invalidWithInvariantr  s/    
 	 	 	
r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r    s     ) )T )r   c                |    \         P                  ! RRR7      pRVn        V P                  VP                  R4       R# )ze
You can set the PDOP value to value inconsisted with HDOP and VDOP
when not checking the invariant.
r)   r  r        Y@N)r   r  r  r   )r   pes   & r   test_setDOPWithoutInvariant.PositionErrorTests.test_setDOPWithoutInvariant  s1    
 Ss3%(r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r    s     ( ($ (r   c                    \         P                  ! RRRR7      pVP                  pR R lpV P                  \        W14       V P                  VP                  V4       R# )z|
Attempting to set the PDOP value to value inconsisted with HDOP and
VDOP when checking the invariant raises C{ValueError}.
r)   T)r  r  r  c                    V ^8  d   QhRRRR/# )r   r  base.PositionErrorr   r   r   )r   s   "r   r   APositionErrorTests.test_setDOPWithInvariant.<locals>.__annotate__  s     	 	* 	t 	r   c                    R V n         R# )r  N)r  )r  s   &r   setPDOP<PositionErrorTests.test_setDOPWithInvariant.<locals>.setPDOP  s	    BGr   N)r   r  r  r/   r0   r   )r   r  r  r  s   &   r   test_setDOPWithInvariant+PositionErrorTests.test_setDOPWithInvariant  sL    
 Ss$Gww	 	*g2$'r   z.<PositionError (pdop: %s, hdop: %s, vdop: %s)>c          
     ,    V ^8  d   QhRRRRRRRRRR/# )	r   r  r  r  zfloat | Noner  r  r   r   r   )r   s   "r   r   r    sC     L LL L 	L
 L 
Lr   c                
   V P                  VP                  V4       V P                  VP                  V4       V P                  VP                  V4       V P                  \	        V4      V P
                  W#V3,          4       R# )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)r   r  r  r  r  s   &&&&&r   _testDOPPositionErrorTests._testDOP  sd    ( 	$'$'$'b4#5#5T8J#JKr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r         , ,t ,r   c                    RRr!V^,          V^,          ,
          R,          p\         P                  ! WR7      pV P                  WAW#4       R# )z6
The VDOP is correctly determined from PDOP and HDOP.
r_   r)         ?)r  r  Nr   r  r  )r   r  r  r  r  s   &    r   test_positionAndHorizontalSet0PositionErrorTests.test_positionAndHorizontalSet  @     #da$'!c)T5b+r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r    s     , ,T ,r   c                    RRr!V^,          V^,          ,
          R,          p\         P                  ! WR7      pV P                  WAW24       R# )z6
The HDOP is correctly determined from PDOP and VDOP.
r_   r)   r  )r  r  Nr  )r   r  r  r  r  s   &    r   test_positionAndVerticalSet.PositionErrorTests.test_positionAndVerticalSet  r  r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r    r  r   c                    RRr!V^,          V^,          ,           R,          p\         P                  ! WR7      pV P                  WCW4       R# )z6
The PDOP is correctly determined from HDOP and VDOP.
r)   r  r  Nr  )r   r  r  r  r  s   &    r   test_horizontalAndVerticalSet0PositionErrorTests.test_horizontalAndVerticalSet  r  r   r   N)r4   r5   r6   r7   r8   r  r  r  r  r  r  r  r  r  r  r  r  r  r9   r   r   r   r  r  @  sQ    ..22*
)( EML2,,, ,r   r  c                  N    ] tR tRtRtR R ltR^R^RR/tR	 R
 ltR R ltRt	R# )BeaconInformationTestsi  z:
Tests for L{twisted.positioning.base.BeaconInformation}.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   #BeaconInformationTests.__annotate__  s     1 1d 1r   c                    \         P                  ! 4       pV P                  \        VP                  4      ^ 4       RpV P                  \        V4      V4       R# )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.
z><BeaconInformation (used beacons (0): [], unused beacons: [])>N)r   BeaconInformationr   lenusedBeaconsr   )r   birL   s   &  r   test_minimal#BeaconInformationTests.test_minimal  sI     ##%R^^,a0R 	 	b<0r   azimuth	elevationsignalToNoiseRatior)   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r    s     !
 !
T !
r   c                z  a  R V 3R llp\        4       p\        ^^
4       F  pVP                  V! VR7      4       K  	  \        P                  ! V4      pS P                  \        VP                  4      ^	4       S P                  \        VP                  4      ^ 4       S P                  \        V4      R4       R# )z_
Tests a beacon information with a bunch of satellites, none of
which used in computing a fix.
c                    V ^8  d   QhRRRR/# )r   rm   rA   r   zbase.Satelliter   )r   s   "r   r   8BeaconInformationTests.test_simple.<locals>.__annotate__  s     	, 	,% 	,N 	,r   c                 |   < \        SP                  4      pVP                  V 4       \        P                  ! R/ VB # )Nr   )dictsatelliteKwargsupdater   	Satellite)rm   kwargsr   s   , r   _buildSatellite;BeaconInformationTests.test_simple.<locals>._buildSatellite  s1    $../FMM">>+F++r   )
identifiera  <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addr   r  r   r  seenBeaconsr  r   )r   r  beaconsprnr  s   f    r   rG   "BeaconInformationTests.test_simple  s    	, 	,
 %B<CKK378   ##G,R^^,a0R^^,a0H	
r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r    s     
 
 
r   c                   \         P                  ! 4       p\        ^^
4       Fl  p\         P                  ! RRV/V P                  B pVP
                  P                  V4       V^,          '       g   KQ  VP                  P                  V4       Kn  	  V P                  \        VP
                  4      ^	4       V P                  \        VP                  4      ^4       V P                  \        V4      R4       R# )z^
Tests a beacon information with a bunch of satellites, some of
them used in computing a fix.
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   )r   r  r  r  r  r  r  r  r   r  r   )r   r  r  	satellites   &   r   test_someSatellitesUsed.BeaconInformationTests.test_someSatellitesUsed  s    
 ##%B<CN#N9M9MNINNy)Qww""9-	   	R^^,a0R^^,a0H
E	
r   r   N)
r4   r5   r6   r7   r8   r   r  rG   r  r9   r   r   r   r  r    s1    1 !![!5I3OO!
F
 
r   r  c                  2    ] tR tRtRtR R ltR R ltRtR# )	PositioningBeaconTestsi%  z&
Tests for L{base.PositioningBeacon}.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   #PositioningBeaconTests.__annotate__*  s     K K Kr   c                    \         P                  ! \        P                  4      pV P	                  V4       \
        P                  ! \         \        P                  ! ^4      4       R# )zH
Tests that L{base.PositioningBeacon} implements L{IPositioningBeacon}.
N)r   implementedByr   PositioningBeacon
assertTruer   verifyObject)r   
implementss   & r   test_interface%PositioningBeaconTests.test_interface*  sB     (55d6L6LM

#.0F0Fq0IJr   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r!  2  s     L L4 Lr   c                d    V P                  \        \        P                  ! R4      4      R4       R# )z)
Tests the repr of a positioning beacon.
Az<Beacon (A)>N)r   r   r   r$  r1   s   &r   r    PositioningBeaconTests.test_repr2  s$     	d44S9:NKr   r   N)r4   r5   r6   r7   r8   r(  r   r9   r   r   r   r  r  %  s    KL Lr   r  c                  2    ] tR tRtRtR R ltR R ltRtR# )	SatelliteTestsi9  z2
Tests for L{twisted.positioning.base.Satellite}.
c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   SatelliteTests.__annotate__>  s     
 
d 
r   c                B   \         P                  ! ^4      pV P                  VP                  ^4       V P	                  VP
                  4       V P	                  VP                  4       V P	                  VP                  4       V P                  \        V4      R4       R# )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.
z:<Satellite (1), azimuth: None, elevation: None, snr: None>N)	r   r  r   r  rB   r  r  r  r   r   ss   & r   r   SatelliteTests.test_minimal>  sv     NN1q)!))$!++&!../GT	
r   c                   V ^8  d   QhRR/# r   r   )r   s   "r   r   r1  N  s     
 
T 
r   c                P   \         P                  ! ^RRRR7      pV P                  VP                  ^4       V P                  VP                  R4       V P                  VP
                  R4       V P                  VP                  R4       V P                  \        V4      R4       R# )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.
g     p@g      >@g      9@)r  r  r  r  z;<Satellite (1), azimuth: 270.0, elevation: 30.0, snr: 25.0>N)r   r  r   r  r  r  r  r   r3  s   & r   rG   SatelliteTests.test_simpleN  s     NN%4D
 	q)E*d+--t4GU	
r   r   N)r4   r5   r6   r7   r8   r   rG   r9   r   r   r   r/  r/  9  s    
 
 
r   r/  N)r8   
__future__r   zope.interfacer   twisted.positioningr   twisted.positioning.baser   r    twisted.positioning.ipositioningr   twisted.trial.unittestr   r
   r;   r   r2  r<  rX  rr  r  r  r  r  r/  r   r   r   <module>r?     s    # ! $ 7 ? +!E !EHt48 t4nH5h H5V34$;H $;N&6 &6R)6 )6XK, K,\T
X T
nLX L(&
X &
r   