예제 #1
0
 def test_GMT(self):
     gmt = GeoLocation.GMT()
     self.assertEqual(gmt.location_name, 'Greenwich, England')
     self.assertEqual(gmt.longitude, 0)
     self.assertEqual(gmt.latitude, 51.4772)
     self.assertTrue(gmt.time_zone._filename.endswith('/GMT'))
     self.assertEqual(gmt.elevation, 0)
예제 #2
0
 def __init__(self, geo_location: Optional[GeoLocation] = None, date: Optional[date] = None, calculator: Optional[AstronomicalCalculations] = None):
     if geo_location is None:
         geo_location = GeoLocation.GMT()
     if date is None:
         date = datetime.today()
     if calculator is None:
         calculator = NOAACalculator()
     self.geo_location = geo_location
     self.date = date
     self.astronomical_calculator = calculator
예제 #3
0
 def test_standard_time_offset_for_standard_timezone(self):
     geo = GeoLocation.GMT()
     geo.time_zone = 'America/New_York'
     self.assertEqual(geo.standard_time_offset(), -5 * GeoLocation.HOUR_MILLIS)
예제 #4
0
 def test_standard_time_offset_for_gmt(self):
     geo = GeoLocation.GMT()
     self.assertEqual(geo.standard_time_offset(), 0)
예제 #5
0
 def test_local_mean_time_offset_for_gmt(self):
     geo = GeoLocation.GMT()
     self.assertEqual(geo.local_mean_time_offset(), 0)
예제 #6
0
 def test_antimeridian_adjustment_for_westward_crossover(self):
     geo = GeoLocation.GMT()
     geo.longitude = 179
     geo.time_zone = 'Etc/GMT+12'
     self.assertEqual(geo.antimeridian_adjustment(), 1)
예제 #7
0
 def test_antimeridian_adjustment_for_standard_timezone(self):
     geo = GeoLocation.GMT()
     geo.time_zone = 'America/New_York'
     self.assertEqual(geo.antimeridian_adjustment(), 0)
예제 #8
0
 def test_antimeridian_adjustment_for_gmt(self):
     geo = GeoLocation.GMT()
     self.assertEqual(geo.antimeridian_adjustment(), 0)
예제 #9
0
 def test_time_zone_with_timezone_object(self):
     geo = GeoLocation.GMT()
     geo.time_zone = tz.gettz('America/New_York')
     self.assertTrue(geo.time_zone._filename.endswith('/America/New_York'))
예제 #10
0
 def test_time_zone_with_string(self):
     geo = GeoLocation.GMT()
     geo.time_zone = 'America/New_York'
     self.assertTrue(geo.time_zone._filename.endswith('/America/New_York'))
예제 #11
0
 def test_longitude_cartography_west(self):
     geo = GeoLocation.GMT()
     geo.longitude = 41, 7, 5.17296, 'W'
     self.assertEqual(geo.longitude, -41.1181036)
예제 #12
0
 def test_longitude_numeric(self):
     geo = GeoLocation.GMT()
     geo.longitude = 23.4
     self.assertEqual(geo.longitude, 23.4)
예제 #13
0
 def test_latitude_cartography_south(self):
     geo = GeoLocation.GMT()
     geo.latitude = 41, 7, 5.17296, 'S'
     self.assertEqual(geo.latitude, -41.1181036)
예제 #14
0
 def test_latitude_numeric(self):
     geo = GeoLocation.GMT()
     geo.latitude = 33.3
     self.assertEqual(geo.latitude, 33.3)