Skip to content

Commit

Permalink
Add test for #258 and #266
Browse files Browse the repository at this point in the history
  • Loading branch information
brandon-rhodes committed Feb 17, 2025
1 parent d06cc68 commit e86d411
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ephem/tests/test_rise_set.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,21 @@ def test_raises_error_for_NaN(self):
with self.assertRaises(ValueError):
o.next_rising(m)

def test_avoids_infinite_loop(self):
observer = ephem.Observer()
observer.lat = '69.043'
observer.lon = '20.851'
observer.elev = 1009
observer.date = '2023/5/20 22:20'
sun = ephem.Sun()
t = observer.next_rising(sun) # used to be an infinite loop

# This is probably not an accurate value, as we broke out of the
# loop without a solution, but let's at include it in the test
# anyway, so that we don't change the result in the future
# without at least knowing it.
self.assertEqual(str(t), '2023/5/20 22:33:50')

def test_sun(self):
s = ephem.Sun()
o = ephem.Observer()
Expand Down

0 comments on commit e86d411

Please sign in to comment.