Skip to content

Commit 413c7c9

Browse files
committed
step 8
1 parent 7581844 commit 413c7c9

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

gendiff/formaters/plain.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,20 @@ def format_plain(diff, path=""):
77

88
if status == "added":
99
formatted_value = format_value(value["value"])
10-
lines.append(f"Property '{property_path}'"
11-
f"was added with value: {formatted_value}")
10+
lines.append(f"Property '{property_path}' was added with value: {formatted_value}")
11+
1212
elif status == "removed":
1313
lines.append(f"Property '{property_path}' was removed")
14+
1415
elif status == "modified":
1516
old_value = format_value(value["old_value"])
1617
new_value = format_value(value["new_value"])
17-
lines.append(f"Property '{property_path}'"
18-
f" was updated. From {old_value} to {new_value}")
18+
lines.append(
19+
f"Property '{property_path}' was updated. From {old_value} to {new_value}"
20+
)
21+
1922
elif status == "nested":
20-
lines.append(format_plain(value["children"], property_path))
23+
lines.extend(format_plain(value["children"], property_path).split('\n'))
2124

2225
return "\n".join(lines)
2326

@@ -32,4 +35,4 @@ def format_value(value):
3235
return "null"
3336
if isinstance(value, str):
3437
return f"'{value}'"
35-
return str(value)
38+
return str(value)

test.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
text = "Property 'common.setting1' was added with value: true"
2+
print(text)

0 commit comments

Comments
 (0)