<s> import datetime <EOL> from django . test import TestCase <EOL> from django . utils import timezone <EOL> from schedule . models import Event , Rule , Calendar <EOL> from schedule . utils import EventListManager <EOL> class TestEventListManager ( TestCase ) : <EOL> def setUp ( self ) : <EOL> weekly = Rule . objects . create ( frequency = "<STR_LIT>" ) <EOL> daily = Rule . objects . create ( frequency = "<STR_LIT>" ) <EOL> cal = Calendar . objects . create ( name = "<STR_LIT>" ) <EOL> self . default_tzinfo = timezone . get_default_timezone ( ) <EOL> self . event1 = Event ( ** { <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> '<STR_LIT:start>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:8> , <NUM_LIT:0> , tzinfo = self . default_tzinfo ) , <EOL> '<STR_LIT:end>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:9> , <NUM_LIT:0> , tzinfo = self . default_tzinfo ) , <EOL> '<STR_LIT>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:10> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:0> , tzinfo = self . default_tzinfo ) , <EOL> '<STR_LIT>' : weekly , <EOL> '<STR_LIT>' : cal <EOL> } ) <EOL> self . event1 . save ( ) <EOL> self . event2 = Event ( ** { <EOL> '<STR_LIT:title>' : '<STR_LIT>' , <EOL> '<STR_LIT:start>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:5> , <NUM_LIT:9> , <NUM_LIT:0> , tzinfo = self . default_tzinfo ) , <EOL> '<STR_LIT:end>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:1> , <NUM_LIT:5> , <NUM_LIT:10> , <NUM_LIT:0> , tzinfo = self . default_tzinfo ) , <EOL> '<STR_LIT>' : datetime . datetime ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:5> , <NUM_LIT:0> , <NUM_LIT:0> , tzinfo = self . default_tzinfo ) , <EOL> '<STR_LIT>' : daily , <EOL> '<STR_LIT>' : cal <EOL> } ) <EOL> self . event2 . save ( ) <EOL> def test_occurrences_after ( self ) : <EOL> eml = EventListManager ( [ self . event1 , self . event2 ] ) <EOL> occurrences = eml . occurrences_after ( datetime . datetime ( <NUM_LIT> , <NUM_LIT:4> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:0> , tzinfo = self . default_tzinfo ) ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event1 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event2 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event2 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event2 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event2 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event2 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event2 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event2 ) <EOL> self . assertEqual ( next ( occurrences ) . event , self . event1 ) <EOL> occurrences = eml . occurrences_after ( ) <EOL> self . assertEqual ( list ( occurrences ) , [ ] ) </s>
