Skip to content

Commit

Permalink
Added date_time_ambiguous boolean to Subject class & extra Subject cl…
Browse files Browse the repository at this point in the history
…ass tests.
  • Loading branch information
theriftlab committed Feb 5, 2024
1 parent 3a21b6e commit 58843ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 1 addition & 0 deletions immanuel/charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ def __init__(self, date_time: datetime | str, latitude: float | list | tuple | s
lon=self.longitude,
is_dst=time_is_dst
)
self.date_time_ambiguous = date.ambiguous(self.date_time) and time_is_dst is None
self.julian_date = date.to_jd(self.date_time)


Expand Down
12 changes: 11 additions & 1 deletion tests/test_charts.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ def native(dob, lat, lon):
def partner(partner_dob, partner_lat, partner_lon):
return charts.Subject(partner_dob, partner_lat, partner_lon)

@fixture
def julian_date():
return 2451545.25 # 2000-01-01 18:00 UT

@fixture
def solar_return_year():
return 2030
Expand All @@ -68,7 +72,7 @@ def pdt():
return '2025-06-20 17:00:00'


def test_subject(dob, lat, lon, native):
def test_subject(dob, lat, lon, native, julian_date):
date_time = datetime.fromisoformat(f'{dob} -08:00')
latitude, longitude = (convert.string_to_dec(v) for v in (lat, lon))
assert native.date_time.year == date_time.year
Expand All @@ -79,6 +83,12 @@ def test_subject(dob, lat, lon, native):
assert native.date_time.second == date_time.second
assert native.latitude == latitude
assert native.longitude == longitude
assert native.date_time_ambiguous == False
assert native.julian_date == julian_date

ambiguous_date_time = datetime(2022, 11, 6, 1, 30)
ambiguous_native = charts.Subject(ambiguous_date_time, lat, lon)
assert ambiguous_native.date_time_ambiguous == True


def test_natal(native, lat, lon):
Expand Down

0 comments on commit 58843ac

Please sign in to comment.