Skip to content

Commit 3546969

Browse files
committed
Fixing the string representation.
1 parent a4e9111 commit 3546969

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

nodestream/metrics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def register(self, handler: "MetricHandler"):
2929
return self
3030

3131
def __str__(self):
32-
return f"{self.name}: {self.value}"
32+
return self.name
3333

3434
def __hash__(self):
3535
return hash(self.name)

tests/unit/test_metrics.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,11 @@ def test_metric_equality_and_hash():
152152
assert metric1 == metric2 # Same name
153153
assert metric1 != metric3 # Different name
154154

155+
# Test __str__
156+
assert str(metric1) == "test_metric"
157+
assert str(metric2) == "test_metric"
158+
assert str(metric3) == "different_metric"
159+
155160
# Test __hash__
156161
assert hash(metric1) == hash(metric2) # Same name should have same hash
157162

0 commit comments

Comments
 (0)