Exemple #1
0
 def test800_010_ShouldAccept_Date(self):
     sighting = {
         'op': 'predict',
         'date': '2016-01-17',
         'body': 'betelgeuse'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
Exemple #2
0
 def test800_160_ShouldAddError_wrongfebdaysleap(self):
     sighting = {
         'op': 'predict',
         'body': 'betelgeuse',
         'date': '2017-02-29'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #3
0
 def test800_130_wrongthirtyonedays(self):
     sighting = {
         'op': 'predict',
         'body': 'betelgeuse',
         'date': '2017-04-31'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #4
0
 def test1000_080_format(self):
     sighting = {
         'op': 'predict',
         'body': 'Betelgeuse',
         'date': '2016-01-17',
         'time': '03:15:42'
     }
     result = DP.dispatch(sighting)
     self.assertEquals(result['long'], '75d53.6')
Exemple #5
0
 def test300_930_ShouldAddError_HighOutOfBoundTemperature(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '121'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #6
0
 def test1000_020_ShouldAddError_Long(self):
     sighting = {
         'op': 'predict',
         'time': '03:15:42',
         'body': 'betelgeuse',
         'long': '7d24.3'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #7
0
 def test400_040_ShouldAccept_MissingPressure(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
Exemple #8
0
 def test300_910_ShouldAddError_InvalidValueTemperature(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': 'a'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #9
0
 def test300_020_ShouldAccept_LowBoundTemperature(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '-20'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
Exemple #10
0
 def test001_000_assLong_Missing(self):
     sighting = {
         'op': 'correct',
         'lat': '89d20.1',
         'long': '154d5.4',
         'altitude': '37d17.4',
         'assumedLat': '35d59.7'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #11
0
 def test500_030_ShouldAccept_missingHorizon(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60',
         'pressure': '160'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
Exemple #12
0
 def test400_920_ShouldAddError_LowOutOfBoundPressure(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60',
         'pressure': '99'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #13
0
 def test300_030_ShouldAccept_HighBoundTemperature(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '120'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
     self.assertEquals(result['temperature'], '120')
Exemple #14
0
 def test500_930_ShouldAddError_NonStringHorizon(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60',
         'pressure': '160',
         'horizon': '123'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #15
0
 def test001_000_assLat_IncorrectFormat(self):
     sighting = {
         'op': 'correct',
         'lat': '89d20.1',
         'long': '154d5.4',
         'altitude': '37d17.4',
         'assumedLat': '3559.7',
         'assumedLong': '74d35.3'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #16
0
 def test500_050_ShouldAddError_HighBoundCasedHorizon(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60',
         'pressure': '160',
         'horizon': 'Artificial'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
Exemple #17
0
 def test001_000_correctedAzi_Correct(self):
     sighting = {
         'op': 'correct',
         'lat': '89d20.1',
         'long': '154d5.4',
         'altitude': '37d17.4',
         'assumedLat': '35d59.7',
         'assumedLong': '74d35.3'
     }
     results = DP.dispatch(sighting)
     self.assertEquals(results['correctedAzimuth'], '0d36.8')
Exemple #18
0
 def test001_008_lat_EY(self):
     sighting = {
         'op': 'correct',
         'lat': '89d61.0',
         'long': '154d5.4',
         'altitude': '37d17.4',
         'assumedLat': '35d59.7',
         'assumedLong': '74d35.3'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #19
0
 def test001_003_lat_NX(self):
     sighting = {
         'op': 'correct',
         'lat': '65d20.1',
         'long': '154d5.4',
         'altitude': '37d17.4',
         'assumedLat': '35d59.7',
         'assumedLong': '74d35.3'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
Exemple #20
0
 def test600_910_AltitudeAlreadyPresent(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60',
         'pressure': '160',
         'horizon': 'Natural',
         'altitude': '60d25.5'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #21
0
 def test001_000_correctedAzi_Present(self):
     sighting = {
         'op': 'correct',
         'lat': '89d20.1',
         'long': '154d5.4',
         'altitude': '37d17.4',
         'assumedLat': '35d59.7',
         'assumedLong': '74d35.3',
         'correctedAzimuth': 'od36.8'
     }
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #22
0
 def test500_010_ShouldAccept_LowBoundHorizon(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60',
         'pressure': '160',
         'horizon': 'natural'
     }
     result = DP.dispatch(sighting)
     self.assertTrue(not 'error' in result)
     self.assertEquals(result['horizon'], 'natural')
Exemple #23
0
 def test600_050_CalculateAltitude(self):
     sighting = {
         'op': 'adjust',
         'observation': '10d0.0',
         'height': '6',
         'temperature': '72',
         'pressure': '1010',
         'horizon': 'Artificial'
     }
     result = DP.dispatch(sighting)
     calculatedAltitude = '9d54.7'
     self.assertEquals(result['altitude'], calculatedAltitude)
Exemple #24
0
 def test600_040_CalculateAltitude(self):
     sighting = {
         'op': 'adjust',
         'observation': '45d15.2',
         'height': '6',
         'temperature': '71',
         'pressure': '1010',
         'horizon': 'Natural'
     }
     result = DP.dispatch(sighting)
     calculatedAltitude = '45d11.9'
     self.assertEquals(result['altitude'], calculatedAltitude)
Exemple #25
0
 def test600_010_CalculateDipFromNatural(self):
     sighting = {
         'op': 'adjust',
         'observation': '45d15.2',
         'height': '6',
         'temperature': '71',
         'pressure': '1010',
         'horizon': 'Natural'
     }
     result = DP.dispatch(sighting)
     height = result['height']
     programDip = DP.calculateDip(result['horizon'], int(height))
     calculatedDip = -0.039600084
     self.assertEquals(round(programDip, 9), calculatedDip)
Exemple #26
0
 def test600_020_CalculatesDipFromArtificial(self):
     sighting = {
         'op': 'adjust',
         'observation': '60d1.5',
         'height': '60',
         'temperature': '60',
         'pressure': '160',
         'horizon': 'Artificial'
     }
     result = DP.dispatch(sighting)
     height = result['height']
     programDip = DP.calculateDip(result['horizon'], int(height))
     calculatedDip = 0
     self.assertEquals(programDip, calculatedDip)
Exemple #27
0
 def test600_030_CalculateRefraction(self):
     sighting = {
         'op': 'adjust',
         'observation': '45d15.2',
         'height': '6',
         'temperature': '71',
         'pressure': '1010',
         'horizon': 'Natural'
     }
     result = DP.dispatch(sighting)
     pressure = result['pressure']
     temperature = result['temperature']
     observation = result['observation']
     programRefraction = DP.calculateRefraction(pressure, temperature,
                                                observation)
     calculatedRefraction = -0.015356
     self.assertEquals(round(programRefraction, 6), calculatedRefraction)
Exemple #28
0
 def test100_960_ShouldAddError_MissingAngle(self):
     sighting = {'op': 'adjust', 'observation': ''}
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #29
0
 def test100_950_ShouldAddError_OutOfBoundYY(self):
     sighting = {'op': 'adjust', 'observation': '60d60.0'}
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)
Exemple #30
0
 def test100_940_ShouldAddError_NominalValueX(self):
     sighting = {'op': 'adjust', 'observation': '60d-1'}
     result = DP.dispatch(sighting)
     self.assertTrue('error' in result)