Skip to content

Commit 8609536

Browse files
author
factorychief[bot]
committed
Replace the pgclirc ConfigObj parser while preserving configuration
Closes #1634
1 parent 146e702 commit 8609536

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

‎pgcli/config.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,10 @@ def as_list(self, key):
2525
value = self[key]
2626
if not value:
2727
return [""]
28-
if value == ",":
29-
return []
3028
if isinstance(value, ConfigValue) and value.quoted:
3129
return [str(value)]
30+
if value == ",":
31+
return []
3232
items = []
3333
start = 0
3434
quote = None

‎tests/test_config.py‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,14 @@ def test_configobj_lists_preserve_backslashes(tmp_path):
119119

120120
@pytest.mark.parametrize(
121121
"source, expected",
122-
[("", [""]), ('""', [""]), ("delete,", ["delete"]), (",", [])],
122+
[
123+
("", [""]),
124+
('""', [""]),
125+
("delete,", ["delete"]),
126+
(",", []),
127+
('","', [","]),
128+
("','", [","]),
129+
],
123130
)
124131
def test_configobj_list_edge_cases(tmp_path, source, expected):
125132
filename = tmp_path / "config"

0 commit comments

Comments
 (0)