def test_wallclock_for_operation_no_matching_results(self): """ wallclock_for_operation only considers results which have the 'wallclock' metrics and match the specified operation name. None is returned if no results match. """ operation_name = 'test-operation' results = [ { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': 'another-operation' } }, { 'metric': { 'type': 'cputime' }, 'operation': { 'type': operation_name } }, ] wallclock_result = wallclock_for_operation(results, operation_name) self.assertEqual(wallclock_result, None)
def test_wallclock_for_operation_calculates_result(self): """ wallclock_for_process returns the mean of the values from samples which have the 'wallclock' metric type and match the specified operation. """ operation = 'test-operation' results = [ { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': operation }, 'value': 11 }, { 'metric': { 'type': 'wallclock' }, 'operation': { 'type': operation }, 'value': 14 }, ] wallclock_result = wallclock_for_operation(results, operation) self.assertEqual(wallclock_result, 12.5)
def test_wallclock_for_operation_calculates_result(self): """ wallclock_for_process returns the mean of the values from samples which have the 'wallclock' metric type and match the specified operation. """ operation = "test-operation" results = [ {"metric": {"type": "wallclock"}, "operation": {"type": operation}, "value": 11}, {"metric": {"type": "wallclock"}, "operation": {"type": operation}, "value": 14}, ] wallclock_result = wallclock_for_operation(results, operation) self.assertEqual(wallclock_result, 12.5)
def test_wallclock_for_operation_no_matching_results(self): """ wallclock_for_operation only considers results which have the 'wallclock' metrics and match the specified operation name. None is returned if no results match. """ operation_name = "test-operation" results = [ {"metric": {"type": "wallclock"}, "operation": {"type": "another-operation"}}, {"metric": {"type": "cputime"}, "operation": {"type": operation_name}}, ] wallclock_result = wallclock_for_operation(results, operation_name) self.assertEqual(wallclock_result, None)