def test_unpublished_events(self):
        """Ensure that events manager finds unpublished events correctly."""
        expected = Event.objects.exclude(Q(slug__endswith='upcoming')) \
                                .exclude(slug__in=['ends-today-ongoing',
                                                   'ends-tomorrow-ongoing'])
        self.assertEqual(set(Event.objects.unpublished_events()),
                         set(expected))

        event_considered_published = Event.objects.create(
            slug='published',
            start=date.today() + timedelta(days=3),
            end=date.today() + timedelta(days=6),
            latitude=-10.0, longitude=10.0,
            country='US', venue='University',
            address='Phenomenal Street',
            url='http://url/',
            host=Host.objects.all().first(),
        )
        self.assertNotIn(event_considered_published,
                         Event.objects.unpublished_events())
dataset/ETHPy150Open swcarpentry/amy/workshops/test/test_event.py/TestEvent.test_unpublished_events/original