def test_constructor_defaults(self): execution_context.clear() self.assertEqual({}, execution_context.get_measure_to_view_map()) stats_recorder = stats_recorder_module.StatsRecorder() self.assertIsNotNone(execution_context.get_measure_to_view_map()) self.assertIs(stats_recorder.measure_to_view_map, execution_context.get_measure_to_view_map()) self.assertIsNotNone(stats_recorder.measure_to_view_map)
def test_constructor(self): execution_context.clear() self.assertEqual({}, execution_context.get_measure_to_view_map()) view_manager = view_manager_module.ViewManager() self.assertIsNotNone(view_manager.time) self.assertEqual(view_manager.measure_to_view_map, execution_context.get_measure_to_view_map()) execution_context.clear() measure_to_view_map = {'key1': 'val1'} execution_context.set_measure_to_view_map(measure_to_view_map) self.assertEqual(measure_to_view_map, execution_context.get_measure_to_view_map())
def test_get_and_set(self): execution_context.clear() execution_context.get_measure_to_view_map() self.assertEqual({}, execution_context.get_measure_to_view_map()) measure_to_view_map = {'key1', 'val1'} execution_context.set_measure_to_view_map(measure_to_view_map) execution_context.get_measure_to_view_map() self.assertEqual(measure_to_view_map, execution_context.get_measure_to_view_map())
def __init__(self): self.time = datetime.utcnow().isoformat() + 'Z' if execution_context.get_measure_to_view_map() == {}: execution_context.set_measure_to_view_map(MeasureToViewMap()) self._measure_view_map = execution_context.get_measure_to_view_map()
def __init__(self): self.time = utils.to_iso_str() if execution_context.get_measure_to_view_map() == {}: execution_context.set_measure_to_view_map(MeasureToViewMap()) self._measure_view_map = execution_context.get_measure_to_view_map()
def __init__(self): if execution_context.get_measure_to_view_map() == {}: execution_context.set_measure_to_view_map(MeasureToViewMap()) self.measure_to_view_map = execution_context.get_measure_to_view_map()