def test200_010_ShouldReturnList(self):
        fix = fx.Fix()

        body = 'Aldebaran'
        dateOfObservation = date(2016, 03, 01)
        timeOfObservation = time(23, 40, 01, tzinfo=UTC())
        altitude = (15, 04.6)
        height = 6.0
        temperature = 72
        pressure = 1010
        artificialHorizon = True

        sighting1 = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                                temperature, pressure, artificialHorizon)

        body = 'Alcor'
        dateOfObservation = date(2015, 03, 01)
        timeOfObservation = time(23, 40, 01, tzinfo=UTC())
        altitude = (15, 04.6)
        height = 6.0
        temperature = 80
        pressure = 1000
        artificialHorizon = True

        sighting2 = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                                temperature, pressure, artificialHorizon)

        listOfSighting = fix.getSightings("sighting.xml")

        self.assertEquals(2, len(listOfSighting))
        self.assertEquals(sighting2.getBody(), listOfSighting[0].getBody())
        self.assertEquals(sighting1.getBody(), listOfSighting[1].getBody())
Exemple #2
0
    def test100_030_ShouldConstructWithoutOptionalParam(self):
        body = 'Aldebaran'
        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())
        altitude = (58, 29.2)

        self.assertIsInstance(
            ST.Sighting(body, dateOfObservation, timeOfObservation, altitude), ST.Sighting)
Exemple #3
0
    def test100_940_ShouldNotConstructOnNonDateObject(self):
        expectedString = "Sighting.__init__:"

        timeOfObservation = time(23, 20, 1, tzinfo=UTC())

        with self.assertRaises(ValueError) as context:
            ST.Sighting(body='Aldebaran', date="2016-03-01", time=timeOfObservation, altitude=(58, 29.2), height=6.0,
                        temperature=100, pressure=1000, artificialHorizon=True)
        self.assertEquals(expectedString, context.exception.args[0][0:len(expectedString)],
                          "Major:  failure to check type of Parameter")
Exemple #4
0
    def test100_920_ShouldNotConstructOnLengthLessThanOneForBody(self):
        expectedString = "Sighting.__init__:"

        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())

        with self.assertRaises(ValueError) as context:
            ST.Sighting(body='a', date=dateOfObservation, time=timeOfObservation, altitude=(58, 29.2), height=6.0,
                        temperature=100, pressure=1000, artificialHorizon=True)
        self.assertEquals(expectedString, context.exception.args[0][0:len(expectedString)],
                          "Major:  failure to check length of Parameter")
Exemple #5
0
    def test600_020_ShouldReturnDefaultHeight(self):
        body = 'Aldebaran'
        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())
        altitude = (58, 29.2)
        temperature = 100
        pressure = 1000
        artificialHorizon = True

        sighting = ST.Sighting(body=body, date=dateOfObservation, time=timeOfObservation, altitude=altitude,
                               temperature=temperature, pressure=pressure, artificialHorizon=artificialHorizon)
        self.assertEquals(0.0, sighting.getHeight())
Exemple #6
0
    def test100_010_ShouldConstruct(self):
        body = 'Aldebaran'
        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())
        altitude = (58, 29.2)
        height = 6.0
        temperature = 100
        pressure = 1000
        artificialHorizon = True

        self.assertIsInstance(ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                                          temperature, pressure, artificialHorizon), ST.Sighting)
Exemple #7
0
    def test100_020_ShouldConstruct(self):
        body = 'Aldebaran'
        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())
        altitude = 58, 29.2
        height = 6.0
        temperature = 100
        pressure = 1000
        artificialHorizon = True

        sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                               temperature, pressure, artificialHorizon)
        self.assertEquals('Aldebaran', sighting.body)
Exemple #8
0
    def test900_010_ShouldReturnArtificialHorizon(self):
        body = 'Aldebaran'
        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())
        altitude = (58, 29.2)
        height = 6.0
        temperature = 100
        pressure = 1000
        artificialHorizon = True

        sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                               temperature, pressure, artificialHorizon)
        self.assertEquals(True, sighting.isArtificialHorizon())
Exemple #9
0
    def test1000_020_ShouldReturnCorrectedAltitude(self):
        body = 'Aldebaran'
        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())
        altitude = (35, 14.8)
        height = 9
        temperature = 72
        pressure = 1010
        artificialHorizon = True

        sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                               temperature, pressure, artificialHorizon)
        self.assertEquals(35, sighting.getAltitudeCorrection()[0])
        self.assertAlmostEquals(10.6, sighting.getAltitudeCorrection()[1], 1)
Exemple #10
0
    def test500_010_ShouldReturnAltitude(self):
        body = 'Aldebaran'
        dateOfObservation = date(2016, 3, 1)
        timeOfObservation = time(23, 20, 1, tzinfo=UTC())
        altitude = (58, 51.49)
        height = 6.0
        temperature = 100
        pressure = 1000
        artificialHorizon = True

        sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                               temperature, pressure, artificialHorizon)
        self.assertEquals(58, sighting.getAltitude()[0])
        self.assertAlmostEquals(51.4, sighting.getAltitude()[1], 1)
Exemple #11
0
    def test1100_010_ShouldReturnGHA(self):
        body = 'Betelgeuse'
        dateOfObservation = date(2016, 1, 17)
        timeOfObservation = time(3, 15, 42, tzinfo=UTC())
        altitude = (35, 14.8)
        height = 9
        temperature = 72
        pressure = 1010
        artificialHorizon = True

        sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                               temperature, pressure, artificialHorizon)
        
        gha = sighting.getGHA('aries.txt', 'stars.txt')
        self.assertEquals('75*54.3', gha[0])
        self.assertEquals('7*24.3', gha[1])
Exemple #12
0
 def test200_960_ShouldRaiseErrorOnBadFileContent(self):
     expectedString = "Sighting.getGHA:"
     body = 'Betelgeuse'
     dateOfObservation = date(2016, 1, 17)
     timeOfObservation = time(3, 15, 42, tzinfo=UTC())
     altitude = (35, 14.8)
     height = 9
     temperature = 72
     pressure = 1010
     artificialHorizon = True
     
     sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                            temperature, pressure, artificialHorizon)
     with self.assertRaises(ValueError) as context:
         sighting.getGHA("ariesBad.txt", "stars.txt")
     self.assertEquals(expectedString, context.exception.args[0][0:len(expectedString)],
                       "Major:  failure to check for invalid file name")
Exemple #13
0
 def test1100_940_ShouldRaiseErrorOnMissingFile(self):
     expectedString = "Sighting.getGHA:"
     body = 'Betelgeuse'
     dateOfObservation = date(2016, 1, 17)
     timeOfObservation = time(3, 15, 42, tzinfo=UTC())
     altitude = (35, 14.8)
     height = 9
     temperature = 72
     pressure = 1010
     artificialHorizon = True
     
     sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                            temperature, pressure, artificialHorizon)
     randomFileName = ''.join(random.choice('abcd01234') for x in range(8)) + "txt"
     with self.assertRaises(ValueError) as context:
         sighting.getGHA(aries='aries.txt',stars=randomFileName)
     self.assertEquals(expectedString, context.exception.args[0][0:len(expectedString)],
                       "Major:  failure to check for missing file")
Exemple #14
0
 def test1100_930_ShouldFailForWrongParameterType(self):
     expectedString = "Sighting.getGHA:"
     body = 'Betelgeuse'
     dateOfObservation = date(2016, 1, 17)
     timeOfObservation = time(3, 15, 42, tzinfo=UTC())
     altitude = (35, 14.8)
     height = 9
     temperature = 72
     pressure = 1010
     artificialHorizon = True
     
     sighting = ST.Sighting(body, dateOfObservation, timeOfObservation, altitude, height,
                            temperature, pressure, artificialHorizon)
     
     with self.assertRaises(ValueError) as context:
         sighting.getGHA(aries='aries.txt', stars=123)
     self.assertEquals(expectedString, context.exception.args[0][0:len(expectedString)],
                       "Major:  failure to check type of Parameter")