<s> """<STR_LIT>""" <EOL> from twisted . trial . unittest import TestCase <EOL> from twisted . positioning import base <EOL> from twisted . positioning . base import Angles , Directions <EOL> from twisted . positioning . ipositioning import IPositioningBeacon <EOL> from zope . interface import verify <EOL> class AngleTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_empty ( self ) : <EOL> """<STR_LIT>""" <EOL> a = base . Angle ( ) <EOL> self . assertEqual ( "<STR_LIT>" , repr ( a ) ) <EOL> def test_variation ( self ) : <EOL> """<STR_LIT>""" <EOL> a = base . Angle ( angleType = Angles . VARIATION ) <EOL> self . assertEqual ( "<STR_LIT>" , repr ( a ) ) <EOL> def test_unknownType ( self ) : <EOL> """<STR_LIT>""" <EOL> a = base . Angle ( <NUM_LIT:1.0> ) <EOL> self . assertEqual ( "<STR_LIT>" , repr ( a ) ) <EOL> def test_bogusType ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , base . Angle , angleType = "<STR_LIT>" ) <EOL> class HeadingTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_simple ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading ( <NUM_LIT:1.> ) <EOL> self . assertEqual ( h . inDecimalDegrees , <NUM_LIT:1.> ) <EOL> self . assertEqual ( float ( h ) , <NUM_LIT:1.> ) <EOL> self . assertEqual ( h . variation , None ) <EOL> self . assertEqual ( h . correctedHeading , None ) <EOL> def test_headingWithoutVariationRepr ( self ) : <EOL> """<STR_LIT>""" <EOL> heading = base . Heading ( <NUM_LIT:1.> ) <EOL> expectedRepr = "<STR_LIT>" <EOL> self . assertEqual ( repr ( heading ) , expectedRepr ) <EOL> def test_headingWithVariationRepr ( self ) : <EOL> """<STR_LIT>""" <EOL> angle , variation = <NUM_LIT:1.0> , - <NUM_LIT> <EOL> heading = base . Heading . fromFloats ( angle , variationValue = variation ) <EOL> reprTemplate = '<STR_LIT>' <EOL> self . assertEqual ( repr ( heading ) , reprTemplate . format ( angle , variation ) ) <EOL> def test_valueEquality ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( base . Heading ( <NUM_LIT:1.> ) , base . Heading ( <NUM_LIT:1.> ) ) <EOL> def test_valueInequality ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertNotEquals ( base . Heading ( <NUM_LIT:1.> ) , base . Heading ( <NUM_LIT> ) ) <EOL> def test_zeroHeadingEdgeCase ( self ) : <EOL> """<STR_LIT>""" <EOL> base . Heading ( <NUM_LIT:0> ) <EOL> def test_zeroHeading180DegreeVariationEdgeCase ( self ) : <EOL> """<STR_LIT>""" <EOL> base . Heading ( <NUM_LIT:0> , <NUM_LIT> ) <EOL> def _badValueTest ( self , ** kw ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , base . Heading . fromFloats , ** kw ) <EOL> def test_badAngleValueEdgeCase ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _badValueTest ( angleValue = <NUM_LIT> ) <EOL> def test_badVariationEdgeCase ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _badValueTest ( variationValue = - <NUM_LIT> ) <EOL> def test_negativeHeading ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _badValueTest ( angleValue = - <NUM_LIT> ) <EOL> def test_headingTooLarge ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _badValueTest ( angleValue = <NUM_LIT> ) <EOL> def test_variationTooNegative ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _badValueTest ( variationValue = - <NUM_LIT> ) <EOL> def test_variationTooPositive ( self ) : <EOL> """<STR_LIT>""" <EOL> self . _badValueTest ( variationValue = <NUM_LIT> ) <EOL> def test_correctedHeading ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT:1.> , variationValue = - <NUM_LIT> ) <EOL> self . assertEqual ( h . correctedHeading , base . Angle ( <NUM_LIT> , Angles . HEADING ) ) <EOL> def test_correctedHeadingOverflow ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT> , variationValue = - <NUM_LIT> ) <EOL> self . assertEqual ( h . correctedHeading , base . Angle ( <NUM_LIT:1.> , Angles . HEADING ) ) <EOL> def test_correctedHeadingOverflowEdgeCase ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT> , variationValue = - <NUM_LIT:1.> ) <EOL> self . assertEqual ( h . correctedHeading , base . Angle ( <NUM_LIT:0.> , Angles . HEADING ) ) <EOL> def test_correctedHeadingUnderflow ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT:1.> , variationValue = <NUM_LIT> ) <EOL> self . assertEqual ( h . correctedHeading , base . Angle ( <NUM_LIT> , Angles . HEADING ) ) <EOL> def test_correctedHeadingUnderflowEdgeCase ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT:1.> , variationValue = <NUM_LIT:1.> ) <EOL> self . assertEqual ( h . correctedHeading , base . Angle ( <NUM_LIT:0.> , Angles . HEADING ) ) <EOL> def test_setVariationSign ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT:1.> , variationValue = <NUM_LIT:1.> ) <EOL> h . setSign ( <NUM_LIT:1> ) <EOL> self . assertEqual ( h . variation . inDecimalDegrees , <NUM_LIT:1.> ) <EOL> h . setSign ( - <NUM_LIT:1> ) <EOL> self . assertEqual ( h . variation . inDecimalDegrees , - <NUM_LIT:1.> ) <EOL> def test_setBadVariationSign ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT:1.> , variationValue = <NUM_LIT:1.> ) <EOL> self . assertRaises ( ValueError , h . setSign , - <NUM_LIT:50> ) <EOL> self . assertEqual ( h . variation . inDecimalDegrees , <NUM_LIT:1.> ) <EOL> self . assertRaises ( ValueError , h . setSign , <NUM_LIT:0> ) <EOL> self . assertEqual ( h . variation . inDecimalDegrees , <NUM_LIT:1.> ) <EOL> self . assertRaises ( ValueError , h . setSign , <NUM_LIT:50> ) <EOL> self . assertEqual ( h . variation . inDecimalDegrees , <NUM_LIT:1.> ) <EOL> def test_setUnknownVariationSign ( self ) : <EOL> """<STR_LIT>""" <EOL> h = base . Heading . fromFloats ( <NUM_LIT:1.> ) <EOL> self . assertIdentical ( None , h . variation . inDecimalDegrees ) <EOL> self . assertRaises ( ValueError , h . setSign , <NUM_LIT:1> ) <EOL> class CoordinateTests ( TestCase ) : <EOL> def test_float ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( <NUM_LIT> ) <EOL> self . assertEqual ( float ( coordinate ) , <NUM_LIT> ) <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( <NUM_LIT> ) <EOL> expectedRepr = "<STR_LIT>" . format ( <NUM_LIT> ) <EOL> self . assertEqual ( repr ( coordinate ) , expectedRepr ) <EOL> def test_positiveLatitude ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( <NUM_LIT> , Angles . LATITUDE ) <EOL> expectedRepr = "<STR_LIT>" . format ( <NUM_LIT> ) <EOL> self . assertEqual ( repr ( coordinate ) , expectedRepr ) <EOL> def test_negativeLatitude ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( - <NUM_LIT> , Angles . LATITUDE ) <EOL> expectedRepr = "<STR_LIT>" . format ( - <NUM_LIT> ) <EOL> self . assertEqual ( repr ( coordinate ) , expectedRepr ) <EOL> def test_positiveLongitude ( self ) : <EOL> """<STR_LIT>""" <EOL> longitude = base . Coordinate ( <NUM_LIT> , Angles . LONGITUDE ) <EOL> expectedRepr = "<STR_LIT>" . format ( <NUM_LIT> ) <EOL> self . assertEqual ( repr ( longitude ) , expectedRepr ) <EOL> def test_negativeLongitude ( self ) : <EOL> """<STR_LIT>""" <EOL> longitude = base . Coordinate ( - <NUM_LIT> , Angles . LONGITUDE ) <EOL> expectedRepr = "<STR_LIT>" . format ( - <NUM_LIT> ) <EOL> self . assertEqual ( repr ( longitude ) , expectedRepr ) <EOL> def test_bogusCoordinateType ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , base . Coordinate , <NUM_LIT> , "<STR_LIT>" ) <EOL> def test_angleTypeNotCoordinate ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , base . Coordinate , <NUM_LIT> , Angles . HEADING ) <EOL> def test_equality ( self ) : <EOL> """<STR_LIT>""" <EOL> def makeCoordinate ( ) : <EOL> return base . Coordinate ( <NUM_LIT:1.0> , Angles . LONGITUDE ) <EOL> self . assertEqual ( makeCoordinate ( ) , makeCoordinate ( ) ) <EOL> def test_differentAnglesInequality ( self ) : <EOL> """<STR_LIT>""" <EOL> c1 = base . Coordinate ( <NUM_LIT:1.0> ) <EOL> c2 = base . Coordinate ( - <NUM_LIT:1.0> ) <EOL> self . assertNotEqual ( c1 , c2 ) <EOL> def test_differentTypesInequality ( self ) : <EOL> """<STR_LIT>""" <EOL> c1 = base . Coordinate ( <NUM_LIT:1.0> , Angles . LATITUDE ) <EOL> c2 = base . Coordinate ( <NUM_LIT:1.0> , Angles . LONGITUDE ) <EOL> self . assertNotEqual ( c1 , c2 ) <EOL> def test_sign ( self ) : <EOL> """<STR_LIT>""" <EOL> c = base . Coordinate ( <NUM_LIT> , Angles . LATITUDE ) <EOL> c . setSign ( <NUM_LIT:1> ) <EOL> self . assertEqual ( c . inDecimalDegrees , <NUM_LIT> ) <EOL> c . setSign ( - <NUM_LIT:1> ) <EOL> self . assertEqual ( c . inDecimalDegrees , - <NUM_LIT> ) <EOL> def test_badVariationSign ( self ) : <EOL> """<STR_LIT>""" <EOL> value = <NUM_LIT> <EOL> c = base . Coordinate ( value , Angles . LATITUDE ) <EOL> self . assertRaises ( ValueError , c . setSign , - <NUM_LIT:50> ) <EOL> self . assertEqual ( c . inDecimalDegrees , <NUM_LIT> ) <EOL> self . assertRaises ( ValueError , c . setSign , <NUM_LIT:0> ) <EOL> self . assertEqual ( c . inDecimalDegrees , <NUM_LIT> ) <EOL> self . assertRaises ( ValueError , c . setSign , <NUM_LIT:50> ) <EOL> self . assertEqual ( c . inDecimalDegrees , <NUM_LIT> ) <EOL> def test_northernHemisphere ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( <NUM_LIT:1.0> , Angles . LATITUDE ) <EOL> self . assertEqual ( coordinate . hemisphere , Directions . NORTH ) <EOL> def test_easternHemisphere ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( <NUM_LIT:1.0> , Angles . LONGITUDE ) <EOL> self . assertEqual ( coordinate . hemisphere , Directions . EAST ) <EOL> def test_southernHemisphere ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( - <NUM_LIT:1.0> , Angles . LATITUDE ) <EOL> self . assertEqual ( coordinate . hemisphere , Directions . SOUTH ) <EOL> def test_westernHemisphere ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( - <NUM_LIT:1.0> , Angles . LONGITUDE ) <EOL> self . assertEqual ( coordinate . hemisphere , Directions . WEST ) <EOL> def test_badHemisphere ( self ) : <EOL> """<STR_LIT>""" <EOL> coordinate = base . Coordinate ( <NUM_LIT:1.0> , None ) <EOL> self . assertRaises ( ValueError , lambda : coordinate . hemisphere ) <EOL> def test_latitudeTooLarge ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , _makeLatitude , <NUM_LIT> ) <EOL> self . assertRaises ( ValueError , _makeLatitude , <NUM_LIT> ) <EOL> def test_latitudeTooSmall ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , _makeLatitude , - <NUM_LIT> ) <EOL> self . assertRaises ( ValueError , _makeLatitude , - <NUM_LIT> ) <EOL> def test_longitudeTooLarge ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , _makeLongitude , <NUM_LIT> ) <EOL> self . assertRaises ( ValueError , _makeLongitude , <NUM_LIT> ) <EOL> def test_longitudeTooSmall ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , _makeLongitude , - <NUM_LIT> ) <EOL> self . assertRaises ( ValueError , _makeLongitude , - <NUM_LIT> ) <EOL> def test_inDegreesMinutesSeconds ( self ) : <EOL> """<STR_LIT>""" <EOL> c = base . Coordinate ( <NUM_LIT> , Angles . LATITUDE ) <EOL> self . assertEqual ( c . inDegreesMinutesSeconds , ( <NUM_LIT:50> , <NUM_LIT:30> , <NUM_LIT:0> ) ) <EOL> c = base . Coordinate ( <NUM_LIT> , Angles . LATITUDE ) <EOL> self . assertEqual ( c . inDegreesMinutesSeconds , ( <NUM_LIT:50> , <NUM_LIT:12> , <NUM_LIT> ) ) <EOL> def test_unknownAngleInDegreesMinutesSeconds ( self ) : <EOL> """<STR_LIT>""" <EOL> c = base . Coordinate ( None , None ) <EOL> self . assertEqual ( c . inDegreesMinutesSeconds , None ) <EOL> def _makeLatitude ( value ) : <EOL> """<STR_LIT>""" <EOL> return base . Coordinate ( value , Angles . LATITUDE ) <EOL> def _makeLongitude ( value ) : <EOL> """<STR_LIT>""" <EOL> return base . Coordinate ( value , Angles . LONGITUDE ) <EOL> class AltitudeTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_value ( self ) : <EOL> """<STR_LIT>""" <EOL> altitude = base . Altitude ( <NUM_LIT:1.> ) <EOL> self . assertEqual ( float ( altitude ) , <NUM_LIT:1.> ) <EOL> self . assertEqual ( altitude . inMeters , <NUM_LIT:1.> ) <EOL> self . assertEqual ( altitude . inFeet , <NUM_LIT:1.> / base . METERS_PER_FOOT ) <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> altitude = base . Altitude ( <NUM_LIT:1.> ) <EOL> self . assertEqual ( repr ( altitude ) , "<STR_LIT>" ) <EOL> def test_equality ( self ) : <EOL> """<STR_LIT>""" <EOL> firstAltitude = base . Altitude ( <NUM_LIT:1.> ) <EOL> secondAltitude = base . Altitude ( <NUM_LIT:1.> ) <EOL> self . assertEqual ( firstAltitude , secondAltitude ) <EOL> def test_inequality ( self ) : <EOL> """<STR_LIT>""" <EOL> firstAltitude = base . Altitude ( <NUM_LIT:1.> ) <EOL> secondAltitude = base . Altitude ( - <NUM_LIT:1.> ) <EOL> self . assertNotEquals ( firstAltitude , secondAltitude ) <EOL> class SpeedTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_value ( self ) : <EOL> """<STR_LIT>""" <EOL> speed = base . Speed ( <NUM_LIT> ) <EOL> self . assertEqual ( speed . inMetersPerSecond , <NUM_LIT> ) <EOL> self . assertEqual ( float ( speed ) , <NUM_LIT> ) <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> speed = base . Speed ( <NUM_LIT> ) <EOL> self . assertEqual ( repr ( speed ) , "<STR_LIT>" ) <EOL> def test_negativeSpeeds ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , base . Speed , - <NUM_LIT:1.0> ) <EOL> def test_inKnots ( self ) : <EOL> """<STR_LIT>""" <EOL> speed = base . Speed ( <NUM_LIT:1.0> ) <EOL> self . assertEqual ( <NUM_LIT:1> / base . MPS_PER_KNOT , speed . inKnots ) <EOL> def test_asFloat ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <NUM_LIT:1.0> , float ( base . Speed ( <NUM_LIT:1.0> ) ) ) <EOL> class ClimbTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_simple ( self ) : <EOL> """<STR_LIT>""" <EOL> climb = base . Climb ( <NUM_LIT> ) <EOL> self . assertEqual ( climb . inMetersPerSecond , <NUM_LIT> ) <EOL> self . assertEqual ( float ( climb ) , <NUM_LIT> ) <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> climb = base . Climb ( <NUM_LIT> ) <EOL> self . assertEqual ( repr ( climb ) , "<STR_LIT>" ) <EOL> def test_negativeClimbs ( self ) : <EOL> """<STR_LIT>""" <EOL> climb = base . Climb ( - <NUM_LIT> ) <EOL> self . assertEqual ( climb . inMetersPerSecond , - <NUM_LIT> ) <EOL> self . assertEqual ( float ( climb ) , - <NUM_LIT> ) <EOL> def test_speedInKnots ( self ) : <EOL> """<STR_LIT>""" <EOL> climb = base . Climb ( <NUM_LIT:1.0> ) <EOL> self . assertEqual ( <NUM_LIT:1> / base . MPS_PER_KNOT , climb . inKnots ) <EOL> def test_asFloat ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( <NUM_LIT:1.0> , float ( base . Climb ( <NUM_LIT:1.0> ) ) ) <EOL> class PositionErrorTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_allUnset ( self ) : <EOL> """<STR_LIT>""" <EOL> positionError = base . PositionError ( ) <EOL> self . assertEqual ( positionError . pdop , None ) <EOL> self . assertEqual ( positionError . hdop , None ) <EOL> self . assertEqual ( positionError . vdop , None ) <EOL> def test_allUnsetWithInvariant ( self ) : <EOL> """<STR_LIT>""" <EOL> positionError = base . PositionError ( testInvariant = True ) <EOL> self . assertEqual ( positionError . pdop , None ) <EOL> self . assertEqual ( positionError . hdop , None ) <EOL> self . assertEqual ( positionError . vdop , None ) <EOL> def test_withoutInvariant ( self ) : <EOL> """<STR_LIT>""" <EOL> positionError = base . PositionError ( hdop = <NUM_LIT:1.0> ) <EOL> self . assertEqual ( positionError . hdop , <NUM_LIT:1.0> ) <EOL> def test_withInvariant ( self ) : <EOL> """<STR_LIT>""" <EOL> positionError = base . PositionError ( hdop = <NUM_LIT:1.0> , testInvariant = True ) <EOL> self . assertEqual ( positionError . hdop , <NUM_LIT:1.0> ) <EOL> def test_invalidWithoutInvariant ( self ) : <EOL> """<STR_LIT>""" <EOL> error = base . PositionError ( pdop = <NUM_LIT:1.0> , vdop = <NUM_LIT:1.0> , hdop = <NUM_LIT:1.0> ) <EOL> self . assertEqual ( error . pdop , <NUM_LIT:1.0> ) <EOL> self . assertEqual ( error . hdop , <NUM_LIT:1.0> ) <EOL> self . assertEqual ( error . vdop , <NUM_LIT:1.0> ) <EOL> def test_invalidWithInvariant ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertRaises ( ValueError , base . PositionError , <EOL> pdop = <NUM_LIT:1.0> , vdop = <NUM_LIT:1.0> , hdop = <NUM_LIT:1.0> , testInvariant = True ) <EOL> def test_setDOPWithoutInvariant ( self ) : <EOL> """<STR_LIT>""" <EOL> pe = base . PositionError ( hdop = <NUM_LIT:1.0> , vdop = <NUM_LIT:1.0> ) <EOL> pe . pdop = <NUM_LIT> <EOL> self . assertEqual ( pe . pdop , <NUM_LIT> ) <EOL> def test_setDOPWithInvariant ( self ) : <EOL> """<STR_LIT>""" <EOL> pe = base . PositionError ( hdop = <NUM_LIT:1.0> , vdop = <NUM_LIT:1.0> , testInvariant = True ) <EOL> pdop = pe . pdop <EOL> def setPDOP ( pe ) : <EOL> pe . pdop = <NUM_LIT> <EOL> self . assertRaises ( ValueError , setPDOP , pe ) <EOL> self . assertEqual ( pe . pdop , pdop ) <EOL> REPR_TEMPLATE = "<STR_LIT>" <EOL> def _testDOP ( self , pe , pdop , hdop , vdop ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( pe . pdop , pdop ) <EOL> self . assertEqual ( pe . hdop , hdop ) <EOL> self . assertEqual ( pe . vdop , vdop ) <EOL> self . assertEqual ( repr ( pe ) , self . REPR_TEMPLATE % ( pdop , hdop , vdop ) ) <EOL> def test_positionAndHorizontalSet ( self ) : <EOL> """<STR_LIT>""" <EOL> pdop , hdop = <NUM_LIT> , <NUM_LIT:1.0> <EOL> vdop = ( pdop ** <NUM_LIT:2> - hdop ** <NUM_LIT:2> ) ** <NUM_LIT> <EOL> pe = base . PositionError ( pdop = pdop , hdop = hdop ) <EOL> self . _testDOP ( pe , pdop , hdop , vdop ) <EOL> def test_positionAndVerticalSet ( self ) : <EOL> """<STR_LIT>""" <EOL> pdop , vdop = <NUM_LIT> , <NUM_LIT:1.0> <EOL> hdop = ( pdop ** <NUM_LIT:2> - vdop ** <NUM_LIT:2> ) ** <NUM_LIT> <EOL> pe = base . PositionError ( pdop = pdop , vdop = vdop ) <EOL> self . _testDOP ( pe , pdop , hdop , vdop ) <EOL> def test_horizontalAndVerticalSet ( self ) : <EOL> """<STR_LIT>""" <EOL> hdop , vdop = <NUM_LIT:1.0> , <NUM_LIT:1.0> <EOL> pdop = ( hdop ** <NUM_LIT:2> + vdop ** <NUM_LIT:2> ) ** <NUM_LIT> <EOL> pe = base . PositionError ( hdop = hdop , vdop = vdop ) <EOL> self . _testDOP ( pe , pdop , hdop , vdop ) <EOL> class BeaconInformationTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_minimal ( self ) : <EOL> """<STR_LIT>""" <EOL> bi = base . BeaconInformation ( ) <EOL> self . assertEqual ( len ( bi . usedBeacons ) , <NUM_LIT:0> ) <EOL> expectedRepr = ( "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> self . assertEqual ( repr ( bi ) , expectedRepr ) <EOL> satelliteKwargs = { "<STR_LIT>" : <NUM_LIT:1> , "<STR_LIT>" : <NUM_LIT:1> , "<STR_LIT>" : <NUM_LIT:1.> } <EOL> def test_simple ( self ) : <EOL> """<STR_LIT>""" <EOL> def _buildSatellite ( ** kw ) : <EOL> kwargs = dict ( self . satelliteKwargs ) <EOL> kwargs . update ( kw ) <EOL> return base . Satellite ( ** kwargs ) <EOL> beacons = set ( ) <EOL> for prn in range ( <NUM_LIT:1> , <NUM_LIT:10> ) : <EOL> beacons . add ( _buildSatellite ( identifier = prn ) ) <EOL> bi = base . BeaconInformation ( beacons ) <EOL> self . assertEqual ( len ( bi . seenBeacons ) , <NUM_LIT:9> ) <EOL> self . assertEqual ( len ( bi . usedBeacons ) , <NUM_LIT:0> ) <EOL> self . assertEqual ( repr ( bi ) , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_someSatellitesUsed ( self ) : <EOL> """<STR_LIT>""" <EOL> bi = base . BeaconInformation ( ) <EOL> for prn in range ( <NUM_LIT:1> , <NUM_LIT:10> ) : <EOL> satellite = base . Satellite ( identifier = prn , ** self . satelliteKwargs ) <EOL> bi . seenBeacons . add ( satellite ) <EOL> if prn % <NUM_LIT:2> : <EOL> bi . usedBeacons . add ( satellite ) <EOL> self . assertEqual ( len ( bi . seenBeacons ) , <NUM_LIT:9> ) <EOL> self . assertEqual ( len ( bi . usedBeacons ) , <NUM_LIT:5> ) <EOL> self . assertEqual ( repr ( bi ) , <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> class PositioningBeaconTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_interface ( self ) : <EOL> """<STR_LIT>""" <EOL> implements = IPositioningBeacon . implementedBy ( base . PositioningBeacon ) <EOL> self . assertTrue ( implements ) <EOL> verify . verifyObject ( IPositioningBeacon , base . PositioningBeacon ( <NUM_LIT:1> ) ) <EOL> def test_repr ( self ) : <EOL> """<STR_LIT>""" <EOL> self . assertEqual ( repr ( base . PositioningBeacon ( "<STR_LIT:A>" ) ) , "<STR_LIT>" ) <EOL> class SatelliteTests ( TestCase ) : <EOL> """<STR_LIT>""" <EOL> def test_minimal ( self ) : <EOL> """<STR_LIT>""" <EOL> s = base . Satellite ( <NUM_LIT:1> ) <EOL> self . assertEqual ( s . identifier , <NUM_LIT:1> ) <EOL> self . assertEqual ( s . azimuth , None ) <EOL> self . assertEqual ( s . elevation , None ) <EOL> self . assertEqual ( s . signalToNoiseRatio , None ) <EOL> self . assertEqual ( repr ( s ) , "<STR_LIT>" <EOL> "<STR_LIT>" ) <EOL> def test_simple ( self ) : <EOL> """<STR_LIT>""" <EOL> s = base . Satellite ( identifier = <NUM_LIT:1> , <EOL> azimuth = <NUM_LIT> , <EOL> elevation = <NUM_LIT> , <EOL> signalToNoiseRatio = <NUM_LIT> ) <EOL> self . assertEqual ( s . identifier , <NUM_LIT:1> ) <EOL> self . assertEqual ( s . azimuth , <NUM_LIT> ) <EOL> self . assertEqual ( s . elevation , <NUM_LIT> ) <EOL> self . assertEqual ( s . signalToNoiseRatio , <NUM_LIT> ) <EOL> self . assertEqual ( repr ( s ) , "<STR_LIT>" <EOL> "<STR_LIT>" ) </s>
