# Path: schedule/forms.py
# class EventForm(SpanForm):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
# 
#     end_recurring_period = forms.DateTimeField(
#         label=_("End recurring period"),
#         help_text=_("This date is ignored for one time only events."),
#         required=False,
#     )
# 
#     class Meta:
#         model = Event
#         exclude = ("creator", "created_on", "calendar")


import datetime
from django.test import TestCase
from schedule.forms import EventForm




class TestScheduleForms(TestCase):
    def test_event_form(self):
        now = datetime.datetime.now()
        data = {
            "start_0": now.strftime("%Y-%m-%d"),
            "start_1": "00:00",
            "end_0": (now + datetime.timedelta(days=1)).strftime("%Y-%m-%d"),
            "end_1": "00:00",
            "title": "some title",
        }
        form = EventForm(data=data)
        validated = form.is_valid()
        self.assertTrue(validated)

        data["end_0"] = (now - datetime.timedelta(days=1)).strftime("%Y-%m-%d")

# Path: schedule/forms.py
# class EventForm(SpanForm):
#     def __init__(self, *args, **kwargs):
#         super().__init__(*args, **kwargs)
# 
#     end_recurring_period = forms.DateTimeField(
#         label=_("End recurring period"),
#         help_text=_("This date is ignored for one time only events."),
#         required=False,
#     )
# 
#     class Meta:
#         model = Event
#         exclude = ("creator", "created_on", "calendar")


# Path: tests/test_forms.py
import datetime
from django.test import TestCase
from schedule.forms import EventForm





class TestScheduleForms(TestCase):
    def test_event_form(self):
        now = datetime.datetime.now()
        data = {
            "start_0": now.strftime("%Y-%m-%d"),
            "start_1": "00:00",
            "end_0": (now + datetime.timedelta(days=1)).strftime("%Y-%m-%d"),
            "end_1": "00:00",
            "title": "some title",
        }
        form = EventForm(data=data)
        validated = form.is_valid()
        self.assertTrue(validated)

        data["end_0"] = (now - datetime.timedelta(days=1)).strftime("%Y-%m-%d")

        form = EventForm(data=data)