Skip to content

Commit 49d2567

Browse files
test: add failing test for quoted key with colon in complex replace
1 parent 379171a commit 49d2567

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

tests/test_document.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,12 @@ def test_replace_flow_mapping_with_dict(self):
349349
doc2 = doc.replace("config", value={"x": 10})
350350
assert doc2["config"] == {"x": 10}
351351

352+
def test_replace_quoted_key_with_colon_complex_value(self):
353+
"""Regression: colon inside quoted key must not corrupt complex replace."""
354+
doc = Document('"http://example.com": 8080\n')
355+
doc2 = doc.replace("http://example.com", value={"port": 9090})
356+
assert doc2["http://example.com"] == {"port": 9090}
357+
352358
def test_replace_key_with_hash_in_value(self):
353359
doc = Document("color: '#ff0000'\n")
354360
doc2 = doc.replace("color", value={"r": 255, "g": 0, "b": 0})

0 commit comments

Comments
 (0)