def _validate_single_metric(self, metric): validation.metric_name(metric['name']) assert isinstance(metric['timestamp'], (int, float)), "Timestamp must be a number" assert isinstance(metric['value'], (int, long, float)), "Value must be a number" if "dimensions" in metric: for dimension_key in metric['dimensions']: validation.dimension_key(dimension_key) validation.dimension_value(metric['dimensions'][dimension_key]) if "value_meta" in metric: validation.validate_value_meta(metric['value_meta'])
def test_valid_value(self): value_meta_value = "this.is_a.valid-value" value_meta = {'value_meta_name': value_meta_value} validation.validate_value_meta(value_meta) self.assertTrue(True)
def test_valid_name(self): value_meta_name = "this.is_a.valid-name" value_meta = {value_meta_name: 'value_meta_value'} validation.validate_value_meta(value_meta) self.assertTrue(True)