コード例 #1
0
 def test300_101_Success_CalculationMissingDateAndTime(self):
     result = predict.predict({'op': 'predict', 'body': 'Betelgeuse'})
     self.assert_('error' not in result)
     self.assertAlmostEqual(dispatch.degreeToDecimal(result['long']),
                            dispatch.degreeToDecimal('11d41.6'),
                            places=None,
                            delta=1)
     self.assertEqual(result['lat'], '7d24.3')
コード例 #2
0
 def test300_113_Error_NoBody(self):
     result = predict.predict({
         'op': 'predict',
         'date': '2016-01-17',
         'time': '25:61:61'
     })
     self.assert_('error' in result)
     self.assertEqual(result['error'],
                      dispatch.ERROR_MANDATORY_INFO_MISSING)
コード例 #3
0
 def test300_112_Error_InvalidTime(self):
     result = predict.predict({
         'op': 'predict',
         'body': 'Betelgeuse',
         'date': '2016-01-17',
         'time': '25:61:61'
     })
     self.assert_('error' in result)
     self.assertEqual(result['error'], dispatch.ERROR_INVALID_TIME)
コード例 #4
0
 def test300_111_Error_InvalidDate(self):
     result = predict.predict({
         'op': 'predict',
         'body': 'Betelgeuse',
         'date': '13/13/9999',
         'time': '03:15:42'
     })
     self.assert_('error' in result)
     self.assertEqual(result['error'], dispatch.ERROR_INVALID_DATE)
コード例 #5
0
 def test300_110_Error_StarNotInCatalogue(self):
     result = predict.predict({
         'op': 'predict',
         'body': 'asdf',
         'date': '2016-01-17',
         'time': '03:15:42'
     })
     self.assert_('error' in result)
     self.assertEqual(result['error'], dispatch.ERROR_STAR_NOT_IN_CATALOGUE)
コード例 #6
0
 def test300_115_Error_ContainsLong(self):
     result = predict.predict({
         'op': 'predict',
         'body': 'asdf',
         'date': '2016-01-17',
         'time': '03:15:42',
         'long': '7d24.3'
     })
     self.assert_('error' in result)
     self.assertEqual(result['error'], dispatch.ERROR_LAT_LON_INCLUDED)
コード例 #7
0
 def test300_100_Success_Calculation(self):
     result = predict.predict({
         'op': 'predict',
         'body': 'Betelgeuse',
         'date': '2016-01-17',
         'time': '03:15:42'
     })
     self.assert_('error' not in result)
     self.assertAlmostEqual(dispatch.degreeToDecimal(result['long']),
                            dispatch.degreeToDecimal('75d53.6'),
                            places=None,
                            delta=1)
     self.assertEqual(result['lat'], '7d24.3')
コード例 #8
0
ファイル: predictTest.py プロジェクト: gsj0001/CSSE
 def test1000_MandatoryInformationMissing(self):
     self.assertEquals(SM.predict({'op': 'predict'}), {
         'error': 'mandatory information is missing',
         'op': 'predict'
     })