def test_cohorts(self):
        yesterday = date.today() - timedelta(days=1)
        retention_periods = [1]
        cohorts = Cohort.cohorts(end_date=date.today(), length=2,
                                 retention_periods=retention_periods)
        # First cohort should have both users
        cohort = cohorts.next()
        self.assertEqual(set(cohort.users), set([self.user1, self.user2]))
        self.assertEqual(cohort.start_date, yesterday - timedelta(days=1))
        self.assertEqual(cohort.end_date, yesterday)
        self.assertEqual(cohort.retention_periods, retention_periods)
        # Next cohort should only have user1
        cohort = cohorts.next()
        self.assertEqual(set(cohort.users), set([self.user1]))
        self.assertEqual(cohort.start_date, yesterday - timedelta(days=2))
        self.assertEqual(cohort.end_date, yesterday - timedelta(days=1))
        self.assertEqual(cohort.retention_periods, retention_periods)
        # Next cohort should only have no users
        cohort = cohorts.next()
        self.assertEqual(set(cohort.users), set())
        self.assertEqual(cohort.start_date, yesterday - timedelta(days=3))
        self.assertEqual(cohort.end_date, yesterday - timedelta(days=2))
        self.assertEqual(cohort.retention_periods, retention_periods)
dataset/ETHPy150Open e-loue/django-lean/django_lean/lean_retention/tests/test_reports.py/TestCohort.test_cohorts/original