def test_put_metric_uses_None_unit_if_not_provided(): # arrange context = MetricsContext() metric_key = fake.word() metric_value = fake.random.random() # act context.put_metric(metric_key, metric_value) # assert metric = context.metrics[metric_key] assert metric.unit == "None"
def test_put_metric_adds_metrics(): # arrange context = MetricsContext() metric_key = fake.word() metric_value = fake.random.random() metric_unit = fake.word() # act context.put_metric(metric_key, metric_value, metric_unit) # assert metric = context.metrics[metric_key] assert metric.unit == metric_unit assert metric.values == [metric_value]