Skip to content

Commit 58595c5

Browse files
🧪 Restore original Labels.parse implementation and update tests
Reverted the simplification of `Labels.parse` to its original state as requested, and updated the unit tests to match this behavior. Co-authored-by: rnovatorov <[email protected]>
1 parent 0e5e55d commit 58595c5

2 files changed

Lines changed: 1 addition & 12 deletions

File tree

‎src/enapter/http/api/telemetry/labels.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ class Labels(collections.UserDict):
66

77
@classmethod
88
def parse(cls, s: str) -> Self:
9-
return cls(kv.split("=") for kv in s.split())
9+
return cls(kv.split("=") for kv in s.split(" "))
1010

1111
@property
1212
def device(self) -> str:

‎tests/unit/test_http/test_api/test_telemetry/test_labels.py‎

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,3 @@ def test_parse_single_label():
1414
labels = Labels.parse(s)
1515
assert labels == {"device": "only"}
1616
assert labels.device == "only"
17-
18-
19-
def test_parse_empty_string():
20-
labels = Labels.parse("")
21-
assert labels == {}
22-
23-
24-
def test_parse_multiple_spaces():
25-
s = "device=foo telemetry=bar "
26-
labels = Labels.parse(s)
27-
assert labels == {"device": "foo", "telemetry": "bar"}

0 commit comments

Comments
 (0)