def test_duration(self):
        e = Event()
        self.assertIsNone(e.duration)

        e1 = Event(begin="1993/05/24")
        e1.make_all_day()
        self.assertEqual(e1.duration, timedelta(days=1))

        e2 = Event(begin="1993/05/24", end="1993/05/30")
        self.assertEqual(e2.duration, timedelta(days=6))

        e3 = Event(begin="1993/05/24", duration=timedelta(minutes=1))
        self.assertEqual(e3.duration, timedelta(minutes=1))

        e4 = Event(begin="1993/05/24")
        self.assertEqual(e4.duration, timedelta(seconds=1))

        e5 = Event(begin="1993/05/24")
        e5.duration = {'days': 6, 'hours': 2}
        self.assertEqual(e5.end, arrow.get("1993/05/30T02:00"))
        self.assertEqual(e5.duration, timedelta(hours=146))
Beispiel #2
0
    def test_duration(self):
        e = Event()
        self.assertEqual(e.duration, td())

        e1 = Event(begin=dt(1993, 5, 24))
        e1.make_all_day()
        self.assertEqual(e1.duration, td(days=1))

        e2 = Event(begin=dt(1993, 5, 24), end=dt(1993, 5, 30))
        self.assertEqual(e2.duration, td(days=6))

        e3 = Event(begin=dt(1993, 5, 24), duration=td(minutes=1))
        self.assertEqual(e3.duration, td(minutes=1))

        e4 = Event(begin=dt(1993, 5, 24))
        self.assertEqual(e4.duration, td(0))

        e5 = Event(begin=dt(1993, 5, 24))
        e5.duration = {'days': 6, 'hours': 2}
        self.assertEqual(e5.end, dt(1993, 5, 30, 2, 0))
        self.assertEqual(e5.duration, td(hours=146))
Beispiel #3
0
    def test_duration(self):
        e = Event()
        self.assertIsNone(e.duration)

        e1 = Event(begin="1993/05/24")
        e1.make_all_day()
        self.assertEqual(e1.duration, td(days=1))

        e2 = Event(begin="1993/05/24", end="1993/05/30")
        self.assertEqual(e2.duration, td(days=6))

        e3 = Event(begin="1993/05/24", duration=td(minutes=1))
        self.assertEqual(e3.duration, td(minutes=1))

        e4 = Event(begin="1993/05/24")
        self.assertEqual(e4.duration, td(0))

        e5 = Event(begin="1993/05/24")
        e5.duration = {'days': 6, 'hours': 2}
        self.assertEqual(e5.end, arrow.get("1993/05/30T02:00"))
        self.assertEqual(e5.duration, td(hours=146))
Beispiel #4
0
    def test_duration(self):
        e = Event()
        self.assertIsNone(e.duration)

        birthday = Event(begin="1993/05/24")
        self.assertEqual(birthday.duration, timedelta(days=1))

        vacation = Event(begin="1993/05/24", end="1993/05/30")
        self.assertEqual(vacation.duration, timedelta(days=7))

        e3 = Event(begin=datetime(1993, 5, 24, 12),
                   duration=timedelta(minutes=1))
        self.assertEqual(e3.duration, timedelta(minutes=1))

        e4 = Event(begin=datetime(1993, 5, 24, 12))
        self.assertEqual(e4.duration, timedelta(seconds=1))

        e5 = Event(begin=datetime(1993, 5, 24, 12))
        e5.duration = {'days': 6, 'hours': 2}
        self.assertEqual(e5.end, parse_date_or_datetime("1993/05/30T14:00"))
        self.assertEqual(e5.duration, timedelta(hours=146))