def check_dates(self, event, valid_dates):
for year, dates in valid_dates.items():<EOL><INDENT>for month, days in dates.items():<EOL><INDENT>response = self.client.get(reverse(<EOL>'<STR_LIT>', kwargs={'<STR_LIT>': year, '<STR_LIT>': month}<EOL>))<EOL>self.clean_whitespace(response)<EOL>if days:<EOL><INDENT>self.assertContains(response, event.title)<EOL><DEDENT>else:<EOL><INDENT>self.assertNotContains(response, event.title)<EOL><DEDENT>for day in days:<EOL><INDENT>self.assertContains(response, self.cal_str(day))<EOL><DEDENT>[self.assertNotContains(response, self.cal_str(day)) for<EOL>day in xrange(<NUM_LIT:1>, monthrange(<NUM_LIT>, int(month))[<NUM_LIT:1>] + <NUM_LIT:1>)<EOL>if day not in days]<EOL><DEDENT><DEDENT>
A DRY helper function.