Пример #1
0
 def test_active (self):
     reservation = Reservation({'name':"mine", 'start':100, 'duration':50})
     for current_time in xrange(1, 100):
         assert not reservation.is_active(current_time)
     for current_time in xrange(100, 150):
         assert reservation.is_active(current_time)
     for current_time in xrange(151, 250):
         assert not reservation.is_active(current_time)
Пример #2
0
 def test_active_cyclic (self):
     reservation = Reservation({'name':"mine", 'start':100, 'duration':10, 'cycle':50})
     assert not reservation.is_active(99)
     assert reservation.is_active(100)
     assert reservation.is_active(109)
     assert not reservation.is_active(111)
     assert not reservation.is_active(149)
     assert reservation.is_active(150)
     assert reservation.is_active(159)
     assert not reservation.is_active(161)