Beispiel #1
0
 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')
Beispiel #2
0
 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')
Beispiel #3
0
 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()))
Beispiel #4
0
 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()
Beispiel #5
0
 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)))
Beispiel #6
0
 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()
Beispiel #7
0
 def test_leapProgression(self):
     self.assertEquals(
         '2d56.9',
         str(
             Angle(
                 Prediction('Betelgeuse', '2016-01-17',
                            '03:15:42').leapProgression())))
Beispiel #8
0
 def test_ariesGHA(self):
     self.assertEquals(
         '164d54.5',
         str(
             Angle(
                 Prediction('Betelgeuse', '2016-01-17',
                            '03:15:42').ariesGHA())))
Beispiel #9
0
 def test_cumulativeProgression(self):
     self.assertEquals(
         '-3d34.8',
         str(
             Angle(
                 Prediction('Betelgeuse', '2016-01-17',
                            '03:15:42').cumulativeProgression())))
Beispiel #10
0
 def testMinutesCommutativeNegative(self):
     i = -1.0
     while i < 0.0:
         self.assertAlmostEquals(i, float(Angle.parse(str(Angle(i)))))
         i += 0.01
Beispiel #11
0
 def testNormalize(self):
     self.assertEquals('0d0.0', str(Angle(360.0).normalize(0.0, 360.0)))
Beispiel #12
0
 def testNominal1(self):
     self.assertEquals(
         '45d11.9',
         str(
             AdjustedAltitude(Angle.parse('45d15.2'), 6.0, 1010, 71,
                              'natural')))
Beispiel #13
0
 def testDefaultValues(self):
     try:
         Angle()
     except ValueError as e:
         self.fail('threw: ' + e)
Beispiel #14
0
 def testMinutesHighBound(self):
     try:
         AdjustedAltitude(Angle.parse('0d60.1'))
         self.fail('minute high bound didn\'t raise exception')
     except ValueError:
         sys.exc_clear()
Beispiel #15
0
 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())
Beispiel #16
0
 def testDegreesCommutativePositive(self):
     i = 0.0
     while i < 360.0:
         self.assertAlmostEquals(i, float(Angle.parse(str(Angle(i)))))
         i += 1.0
Beispiel #17
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()
Beispiel #18
0
 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()
Beispiel #19
0
 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()
Beispiel #20
0
 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)
Beispiel #21
0
 def testNominal0(self):
     self.assertEquals(
         '29d59.9',
         str(
             AdjustedAltitude(Angle.parse('30d1.5'), 19.0, 1000, 85,
                              'artificial')))
Beispiel #22
0
 def testGetMinutes(self):
     self.assertEquals('0d60.1', str(Angle.parse('0d60.1')))
Beispiel #23
0
 def testObservationHighBound(self):
     try:
         AdjustedAltitude(Angle.parse('90d0.1'))
         self.fail('observation high bound didn\'t raise exception')
     except ValueError:
         sys.exc_clear()
Beispiel #24
0
 def testObservationLowBound(self):
     try:
         AdjustedAltitude(Angle.parse('0d0.0'))
         self.fail('observation low bound didn\'t raise exception')
     except ValueError:
         sys.exc_clear()
Beispiel #25
0
 def testParse(self):
     self.assertEquals('359d0.0', str(Angle.parse('359d0.0')))