Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Create failing test
  • Loading branch information
yankyhoffman committed Mar 5, 2023
commit 8ec9fa8ea9dad301b890c5a2f52c49faa8619d1c
7 changes: 7 additions & 0 deletions test/test_jewish_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

import test.test_helper
from zmanim.hebrew_calendar.jewish_calendar import JewishCalendar
from zmanim.hebrew_calendar.jewish_date import JewishDate


class TestJewishCalendar(unittest.TestCase):
Expand Down Expand Up @@ -899,3 +900,9 @@ def test_sof_zman_kiddush_levana_between_moldos(self):
expected_time = first_molad + timedelta(microseconds=expected_offset)
# round for floating microsecond precision inconsistency
self.assertEqual(calendar.sof_zman_kiddush_levana_between_moldos().toordinal(), expected_time.toordinal())

def test_date_arithmetic_returns_inherited_type(self):
for instance, type in [(JewishCalendar(5783, 1, 1), JewishCalendar), (JewishDate(5783, 1, 1), JewishDate)]:
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer to keep other types out of this batch of tests, JewishCalendar alone should suffice here. An alternative approach would be to test the method in TestJewishDate, and create a dummy class to ensure the type isn't being lost.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duly noted, indeed keeps the code-base clean.

self.assertIsInstance(instance, type)
instance += timedelta(days=1)
self.assertIsInstance(instance, type)