Skip to content

Commit 4e7901b

Browse files
committed
return metric name in __str__
1 parent a491eb6 commit 4e7901b

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/access/profiling/metrics.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def units(self) -> Unit:
4040
def description(self) -> str:
4141
return self._description
4242

43+
def __str__(self) -> str:
44+
return self._name
45+
4346

4447
# Define common metrics
4548
count = ProfilingMetric("count", Unit("dimensionless"), "Number of calls to region")

tests/test_metrics.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ def test_metric():
1313
assert metric.name == "test_name"
1414
assert metric.units == "second"
1515
assert metric.description == "test_description"
16+
assert f"{metric}" == "test_name"
1617

1718

1819
def test_metric_empty_name():

0 commit comments

Comments
 (0)