Exemple #1
0
    def test_moon_phase_last_quarter(self):
        phase = ephemerides.get_moon_phase(date(2019, 11, 18))
        self.assertEqual('WANING_GIBBOUS', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-19T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 19))
        self.assertEqual('LAST_QUARTER', phase.identifier)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-26T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 20))
        self.assertEqual('WANING_CRESCENT', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-26T')
Exemple #2
0
    def test_moon_phase_full_moon(self):
        phase = ephemerides.get_moon_phase(date(2019, 11, 11))
        self.assertEqual('WAXING_GIBBOUS', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-12T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 12))
        self.assertEqual('FULL_MOON', phase.identifier)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-19T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 13))
        self.assertEqual('WANING_GIBBOUS', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-19T')
Exemple #3
0
    def test_moon_phase_first_crescent(self):
        phase = ephemerides.get_moon_phase(date(2019, 11, 3))
        self.assertEqual('WAXING_CRESCENT', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-04T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 4))
        self.assertEqual('FIRST_QUARTER', phase.identifier)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-12T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 5))
        self.assertEqual('WAXING_GIBBOUS', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-12T')
Exemple #4
0
    def test_moon_phase_new_moon(self):
        phase = ephemerides.get_moon_phase(date(2019, 11, 25))
        self.assertEqual('WANING_CRESCENT', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-26T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 26))
        self.assertEqual('NEW_MOON', phase.identifier)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-12-04T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 27))
        self.assertEqual('WAXING_CRESCENT', phase.identifier)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-12-04T')
Exemple #5
0
    def test_moon_phase_last_quarter(self):
        phase = ephemerides.get_moon_phase(date(2019, 11, 18))
        self.assertEqual(MoonPhaseType.WANING_GIBBOUS, phase.phase_type)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-19T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 19))
        self.assertEqual(MoonPhaseType.LAST_QUARTER, phase.phase_type)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-26T')

        phase = ephemerides.get_moon_phase(date(2019, 11, 20))
        self.assertEqual(MoonPhaseType.WANING_CRESCENT, phase.phase_type)
        self.assertIsNone(phase.time)
        self.assertRegexpMatches(phase.next_phase_date.isoformat(),
                                 '^2019-11-26T')
Exemple #6
0
 def test_get_moon_phase_raises_exception_on_out_of_date_range(self):
     with self.assertRaises(OutOfRangeDateError):
         ephemerides.get_moon_phase(date(1789, 5, 5))