diff --git a/xmodule/tests/test_fields.py b/xmodule/tests/test_fields.py index 50796dbd54..1e928fb1b3 100644 --- a/xmodule/tests/test_fields.py +++ b/xmodule/tests/test_fields.py @@ -7,7 +7,6 @@ import pytest from pytz import UTC from xmodule.fields import Date, RelativeTime, Timedelta -from xmodule.timeinfo import TimeInfo class DateTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring @@ -117,15 +116,6 @@ class TimedeltaTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing TimedeltaTest.delta.to_json(datetime.timedelta(days=1, hours=12, minutes=59, seconds=59)) -class TimeInfoTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring - - def test_time_info(self): - due_date = datetime.datetime(2000, 4, 14, 10, tzinfo=UTC) - grace_pd_string = '1 day 12 hours 59 minutes 59 seconds' - timeinfo = TimeInfo(due_date, grace_pd_string) - assert timeinfo.close_date == (due_date + Timedelta().from_json(grace_pd_string)) - - class RelativeTimeTest(unittest.TestCase): # lint-amnesty, pylint: disable=missing-class-docstring delta = RelativeTime() diff --git a/xmodule/timeinfo.py b/xmodule/timeinfo.py deleted file mode 100644 index f88ed4cb3b..0000000000 --- a/xmodule/timeinfo.py +++ /dev/null @@ -1,42 +0,0 @@ -# lint-amnesty, pylint: disable=missing-module-docstring - -import logging - -from xmodule.fields import Timedelta - -log = logging.getLogger(__name__) - - -class TimeInfo: - """ - This is a simple object that calculates and stores datetime information for an XModule - based on the due date and the grace period string - - So far it parses out three different pieces of time information: - self.display_due_date - the 'official' due date that gets displayed to students - self.grace_period - the length of the grace period - self.close_date - the real due date - - """ - _delta_standin = Timedelta() - - def __init__(self, due_date, grace_period_string_or_timedelta): - if due_date is not None: - self.display_due_date = due_date - - else: - self.display_due_date = None - - if grace_period_string_or_timedelta is not None and self.display_due_date: - if isinstance(grace_period_string_or_timedelta, str): - try: - self.grace_period = TimeInfo._delta_standin.from_json(grace_period_string_or_timedelta) - except: - log.error(f"Error parsing the grace period {grace_period_string_or_timedelta}") - raise - else: - self.grace_period = grace_period_string_or_timedelta - self.close_date = self.display_due_date + self.grace_period - else: - self.grace_period = None - self.close_date = self.display_due_date