<s> from __future__ import unicode_literals <EOL> from datetime import date <EOL> from collections import defaultdict <EOL> from tests . integration_tests . event_factory import create_event , SetMeUp <EOL> from happenings . utils . calendars import EventCalendar , MiniEventCalendar <EOL> class EventCalendarTest ( SetMeUp ) : <EOL> def test_location ( self ) : <EOL> """<STR_LIT>""" <EOL> yr = <NUM_LIT> <EOL> mo = <NUM_LIT:5> <EOL> count = defaultdict ( list ) <EOL> event = create_event ( <EOL> start_date = ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:15> ) , <EOL> end_date = ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:15> ) , <EOL> created_by = self . user , <EOL> title = "<STR_LIT>" , <EOL> description = "<STR_LIT>" , <EOL> repeat = "<STR_LIT>" <EOL> ) <EOL> events = [ event ] <EOL> day = <NUM_LIT:15> <EOL> count_dict = { day : [ ( event . title , event . pk ) ] } <EOL> cal = EventCalendar ( yr , mo , count , events ) <EOL> cal . count = count_dict <EOL> render_result = cal . formatday ( day , <NUM_LIT:0> ) <EOL> self . assertNotIn ( "<STR_LIT>" , render_result ) <EOL> self . assertNotIn ( "<STR_LIT>" , render_result ) <EOL> event . location . create ( <EOL> name = "<STR_LIT>" <EOL> ) <EOL> events = [ event ] <EOL> cal2 = EventCalendar ( yr , mo , count , events ) <EOL> cal2 . count = count_dict <EOL> render_result = cal2 . formatday ( day , <NUM_LIT:0> ) <EOL> self . assertIn ( "<STR_LIT>" , render_result ) <EOL> self . assertIn ( "<STR_LIT>" , render_result ) <EOL> class MiniEventCalendarTest ( SetMeUp ) : <EOL> def test_popover_helper ( self ) : <EOL> yr = <NUM_LIT> <EOL> mo = <NUM_LIT:5> <EOL> count = defaultdict ( list ) <EOL> event = create_event ( <EOL> start_date = ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:15> ) , <EOL> end_date = ( <NUM_LIT> , <NUM_LIT:5> , <NUM_LIT:15> ) , <EOL> created_by = self . user , <EOL> title = "<STR_LIT>" , <EOL> description = "<STR_LIT>" , <EOL> repeat = "<STR_LIT>" <EOL> ) <EOL> days = ( <NUM_LIT:15> , <NUM_LIT> , <NUM_LIT> ) <EOL> [ count [ day ] . append ( ( event . title , event . pk ) ) for day in days ] <EOL> events = [ event ] <EOL> cal = MiniEventCalendar ( yr , mo , count , events ) <EOL> cal . event = event <EOL> for day in days : <EOL> cal . title = event . title <EOL> cal . day = day <EOL> cal . count = { day : [ ( event . title , event . pk ) ] } <EOL> rendered_result = cal . formatday ( day , <NUM_LIT:0> ) <EOL> self . assertIn ( event . title , rendered_result ) </s>
