Пример #1
0
    def setUp(self):
        self.date = Date('1955/05/21')

        self.obs = obs = Observer()
        obs.lat, obs.lon, obs.elev = '33:45:10', '-84:23:37', 320.0
        obs.date = '1997/2/15'

        # Avoid seeing the deprecation warning for old attributes.
        warnings.filterwarnings('ignore', '.', DeprecationWarning)
Пример #2
0
 def test_date_parser_error_message(self):
     with self.assertRaises(ValueError) as e:
         Date('bad string')
     self.assertEqual(
         str(e.exception),
         "your date string 'bad string' does"
         " not look like a year/month/day optionally"
         " followed by hours:minutes:seconds",
     )
Пример #3
0
 def test_EarthSatellite(self):
     self.build(bodytype=EarthSatellite,
                dbentry=('HST                     ',
                         '1 20580U 90037B   04296.45910607  .00000912 '
                         ' 00000-0  59688-4 0  1902',
                         '2 20580  28.4694  17.3953 0004117 265.2946  '
                         '94.7172 14.99359833594524'),
                attributes={
                    'name': 'Hubble Telescope',
                    '_epoch': Date('2004') + 296.45910607 - 1,
                    '_decay': .00000912,
                    '_drag': .59688e-4,
                    '_inc': 28.4694,
                    '_raan': 17.3953,
                    '_e': 4117e-7,
                    '_ap': 265.2946,
                    '_M': 94.7172,
                    '_n': 14.99359833,
                    '_orbit': 59452,
                })
Пример #4
0
 def OFF_test_localtime_premodern(self):
     if time.timezone == 18000:  # test only works in Eastern time zone
         self.assertEqual(localtime(Date('1531/8/24 2:49')),
                          datetime(1957, 10, 4, 15, 28, 34, 4))
Пример #5
0
 def test_localtime_modern(self):
     if time.timezone == 18000:  # test only works in Eastern time zone
         self.assertEqual(localtime(Date('2009/6/23 8:47')),
                          datetime(2009, 6, 23, 4, 47, 0))
Пример #6
0
 def construct_and_compare(args1, args2):
     d1, d2 = Date(args1), Date(args2)
     self.assertTrue(
         abs(d1 - d2) < millisecond,
         'dates not equal:\n %r = date%r\n %r = date%r' %
         (d1.tuple(), args1, d2.tuple(), args2))
Пример #7
0
 def setUp(self):
     self.date = Date('2004/09/04 00:17:15.8')
Пример #8
0
 def construct_and_compare(args1, args2):
     d1, d2 = Date(*args1), Date(*args2)
     self.assert_(
         -1e-15 < (d1 / d2 - 1) < 1e-15,
         'dates not equal:\n %r = date%r\n %r = date%r' %
         (d1.tuple(), args1, d2.tuple(), args2))
Пример #9
0
 def test_year_zero(self):
     # I would have thought the year would be 0, but it looks like
     # libastro considers 1 BC to be the year -1?
     self.assertEqual(str(Date('0')), '-1/1/1 00:00:00')
Пример #10
0
    def test_new_moon_list(self):
        startDate = Date('1983/12/1')
        endDate = Date('1984/12/23')

        newmoons = find_new_moon_between(startDate, endDate)
Пример #11
0
 def test_when_sun_is_at_degree(self):
     startDate = Date('1983/12/1')
     print(when_is_sun_at_degrees_longitude(startDate, 0))
Пример #12
0
 def test_find_solar_terms_between(self):
     startDate = Date("1983/12/1")
     endDate = Date('1984/12/23')
     terms = find_solar_terms_between(startDate, endDate)
     for x in terms:
         print(Date(x))
Пример #13
0
 def test_tuple_that_rounded_to_negative_seconds(self):  # Github issue 223
     d = Date(44417.49999991596)
     self.assertEqual(d.tuple(), (2021, 8, 10, 23, 59, 59.992739))
Пример #14
0
 def test_another_tuple_value(self):
     #d = Date((1994, 7, 16, 20, 15, 0))
     d = Date(34530.34375)
     self.assertEqual(d.tuple(), (1994, 7, 16, 20, 15, 0))