def testLatitudeWithinLowBound(self): try: Correction(Angle.parse('-89d59.9'), Angle.parse('0d0.0'), Angle.parse('1d0.0'), Angle.parse('0d0.0'), Angle.parse('0d0.0')) except ValueError: self.fail('latitude within bounds raised exception')
def testLongitudeWithinHighBound(self): try: Correction(Angle.parse('0d0.0'), Angle.parse('359d59.9'), Angle.parse('1d0.0'), Angle.parse('0d0.0'), Angle.parse('0d0.0')) except ValueError: self.fail('longitude within bounds raised exception')
def testCorrectedAzimuth(self): self.assertEquals( '0d36.8', str( Correction(Angle.parse('89d20.1'), Angle.parse('154d5.4'), Angle.parse('37d17.4'), Angle.parse('35d59.7'), Angle.parse('74d35.3')).correctedAzimuth()))
def testLatitudeOutOfLowBound(self): try: Correction(Angle.parse('-90d0.0'), Angle.parse('0d0.0'), Angle.parse('1d0.0'), Angle.parse('0d0.0'), Angle.parse('0d0.0')) self.fail('latitude out of bounds didn\'t raise exception') except ValueError: sys.exc_clear()
def testHorizonInvalid(self): for i in ('foobar', 'Foobar', 'natificial'): try: AdjustedAltitude(Angle.parse('30d30.0'), horizon=i) self.fail('invalid horizon %s didn\'t raise exception' % i) except ValueError: sys.exc_clear()
def testHorizonValid(self): for i in ('artificial', 'natural', 'Artificial', 'NaTuRaL'): try: AdjustedAltitude(Angle.parse('30d30.0'), horizon=i) except ValueError as e: self.fail('valid horizon %s raised exception: %s' % (i, str(e)))
def testIntermediateDistance(self): self.assertAlmostEquals( -0.789, Correction(Angle.parse('16d32.3'), Angle.parse('95d41.6'), Angle.parse('13d42.3'), Angle.parse('-53d38.4'), Angle.parse('74d35.3')).intermediateDistance(), 3)
def testMinutesCommutativeNegative(self): i = -1.0 while i < 0.0: self.assertAlmostEquals(i, float(Angle.parse(str(Angle(i))))) i += 0.01
def testGetMinutes(self): self.assertEquals('0d60.1', str(Angle.parse('0d60.1')))
def testNominal1(self): self.assertEquals( '45d11.9', str( AdjustedAltitude(Angle.parse('45d15.2'), 6.0, 1010, 71, 'natural')))
def testNominal0(self): self.assertEquals( '29d59.9', str( AdjustedAltitude(Angle.parse('30d1.5'), 19.0, 1000, 85, 'artificial')))
def testCorrectedDistance(self): self.assertEquals( 3950, Correction(Angle.parse('16d32.3'), Angle.parse('95d41.6'), Angle.parse('13d42.3'), Angle.parse('-53d38.4'), Angle.parse('74d35.3')).correctedDistance())
def testDegreesCommutativePositive(self): i = 0.0 while i < 360.0: self.assertAlmostEquals(i, float(Angle.parse(str(Angle(i))))) i += 1.0
def testTemperatureHighBound(self): try: AdjustedAltitude(Angle.parse('30d30.0'), temperature=121) self.fail('temperature high bound didn\'t raise exception') except ValueError: sys.exc_clear()
def testPressureHighBound(self): try: AdjustedAltitude(Angle.parse('30d30.0'), pressure=1101) self.fail('pressure high bound didn\'t raise exception') except ValueError: sys.exc_clear()
def testHeightLowBound(self): try: AdjustedAltitude(Angle.parse('30d30.0'), height=-0.1) self.fail('height low bound didn\'t raise exception') except ValueError: sys.exc_clear()
def testMinutesHighBound(self): try: AdjustedAltitude(Angle.parse('0d60.1')) self.fail('minute high bound didn\'t raise exception') except ValueError: sys.exc_clear()
def testObservationHighBound(self): try: AdjustedAltitude(Angle.parse('90d0.1')) self.fail('observation high bound didn\'t raise exception') except ValueError: sys.exc_clear()
def testObservationLowBound(self): try: AdjustedAltitude(Angle.parse('0d0.0')) self.fail('observation low bound didn\'t raise exception') except ValueError: sys.exc_clear()
def testParse(self): self.assertEquals('359d0.0', str(Angle.parse('359d0.0')))