def test_duration_secs_end_none(self, mock_time): scenario = Scenario() scenario._end_time_secs = None scenario._start_time_secs = 12345 mock_time.time.return_value = 12346 self.assertEqual(1, scenario.duration_secs())
def test_duration_secs_start_none(self): scenario = Scenario() scenario._start_time_secs = None scenario._end_time_secs = 12345 with self.assertRaises(RuntimeError): scenario.duration_secs()
def test_duration_secs_neither_none(self): scenario = Scenario() scenario._start_time_secs = 12345 scenario._end_time_secs = 12346 self.assertEqual(1, scenario.duration_secs())
def test_duration_secs_both_none(self): scenario = Scenario() scenario._start_time_secs = None scenario._end_time_secs = None self.assertIsNone(scenario.duration_secs())