Skip to content

Commit 30e952b

Browse files
committed
update plain stylish
1 parent 65bbe76 commit 30e952b

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

gendiff/gen_diff_plain.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ def stringify_plain(value):
55
result = 'null'
66
elif value is False:
77
result = 'false'
8+
elif isinstance(value, int):
9+
result = value
810
else:
911
result = f"'{value}'"
1012
return result
@@ -15,12 +17,11 @@ def gen_diff_plain(value, lvl=''):
1517
for el, val in value.items():
1618
match val[0]:
1719
case 'nested':
18-
19-
res += gen_diff_plain(val[1], lvl + f'{el}.')
20+
res += gen_diff_plain(val[1], lvl + f'{el}.') + '\n'
2021
case 'added':
2122
if isinstance(val[1], dict):
2223
res += (f"Property '{lvl + el}'"
23-
f" was added with value: [complex value]" + '\n')
24+
f" was added with value: [complex value]") + '\n'
2425
else:
2526
res += (f"Property '{lvl + el}'"
2627
f" was added with value:"
@@ -40,4 +41,4 @@ def gen_diff_plain(value, lvl=''):
4041
res += (f"Property '{lvl + el}'"
4142
f" was updated. From {stringify_plain(val[1])}"
4243
f" to {stringify_plain(val[2])}") + '\n'
43-
return res
44+
return res.strip()

tests/test_data/result_plain.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ Property 'common.setting6.ops' was added with value: 'vops'
88
Property 'group1.baz' was updated. From 'bas' to 'bars'
99
Property 'group1.nest' was updated. From [complex value] to 'str'
1010
Property 'group2' was removed
11-
Property 'group3' was added with value: [complex value]
11+
Property 'group3' was added with value: [complex value]

0 commit comments

Comments
 (0)