Skip to content

Commit

Permalink
Added tests and documentation for updated add_filepath().
Browse files Browse the repository at this point in the history
  • Loading branch information
theriftlab committed Feb 3, 2024
1 parent 1c077b1 commit 1cc0453
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/4-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ You are free to use the actual numerical index for these objects, but of course

Immanuel indexes chart objects numerically rather than by name for two main reasons:

* Avoid name conflicts (eg. the three Liliths).
* Avoid name conflicts (eg. the four Liliths).
* Allow external objects to be easily added from your own extra ephemeris files by their default index.

To demonstrate, asteroid Lilith is number 1181 as designated by the International Astronomical Union. This is the number of the ephemeris file you would need for Immanuel to include it, and on astro.com this is the number you would type into the "Manual entry" box under "Additional objects" to include the asteroid in your chart.
Expand Down
2 changes: 2 additions & 0 deletions docs/5-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -652,6 +652,8 @@ This will return a standard asteroid object:

Congratulations - you have imported an external object into your chart.

If you want Immanuel to only use your own ephemeris files for everything, passing `True` as a second parameter to `add_filepath()` will set the passed path as the only path rather than adding it to the default one.

---

1. [Overview](1-overview.md)
Expand Down
19 changes: 19 additions & 0 deletions tests/test_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
"""

import os
from datetime import datetime

import swisseph as swe
import pytest
from pytest import fixture

from immanuel import charts
Expand Down Expand Up @@ -83,3 +88,17 @@ def test_settings_are_respected(native):

natal = charts.Natal(native)
assert chart.SUN not in natal.aspects


def test_add_filepath(native):
settings.add_filepath(os.path.dirname(__file__))
settings.objects.append(1181)
natal = charts.Natal(native)
assert 1181 in natal.objects

# Cache-bust
settings.add_filepath(os.path.dirname(__file__), True)
native2 = charts.Subject(datetime.now(), '32N43.0', '117W9.0')

with pytest.raises(swe.Error):
charts.Natal(native2)

0 comments on commit 1cc0453

Please sign in to comment.