def test_latest_time(self):
        """
        Test that we're correctly calculating
        the time of the last event of a stream
        """
        for key, events in self.events.items():
            stats = PBSVideoStats()
            latest_time = None
            for event in events:
                stats.add_event(event)
                if event.get('event_date') > latest_time:
                    latest_time = event.get('event_date')
            results = stats.summary()
            self.assertEqual(results.get('latest_time'), latest_time)
dataset/ETHPy150Open pbs/agora-proc/tests/test_stats.py/PBSVideoStatsTestcase.test_latest_time/original