@@ -114,6 +114,10 @@ def test_edit_result():
114
114
assert result .result == "ok"
115
115
assert result .hash == "newhash123"
116
116
assert result .reason is None
117
+ result_dict = result .to_dict ()
118
+ assert result_dict ["result" ] == "ok"
119
+ assert result_dict ["hash" ] == "newhash123"
120
+ assert "reason" not in result_dict
117
121
118
122
# Test error result with reason
119
123
result = EditResult (
@@ -123,7 +127,11 @@ def test_edit_result():
123
127
)
124
128
assert result .result == "error"
125
129
assert result .reason == "hash mismatch"
126
- assert result .hash == "currenthash123"
130
+ assert result .hash is None
131
+ result_dict = result .to_dict ()
132
+ assert result_dict ["result" ] == "error"
133
+ assert result_dict ["reason" ] == "hash mismatch"
134
+ assert "hash" not in result_dict
127
135
128
136
# Test validation error - missing required fields
129
137
with pytest .raises (ValidationError ):
@@ -177,11 +185,7 @@ def test_edit_result_to_dict():
177
185
# Test successful result
178
186
result = EditResult (result = "ok" , hash = "newhash123" )
179
187
result_dict = result .to_dict ()
180
- assert result_dict == {
181
- "result" : "ok" ,
182
- "hash" : "newhash123" ,
183
- "reason" : None ,
184
- }
188
+ assert result_dict == {"result" : "ok" , "hash" : "newhash123" }
185
189
186
190
# Test error result
187
191
result = EditResult (
@@ -190,11 +194,7 @@ def test_edit_result_to_dict():
190
194
hash = "currenthash123" ,
191
195
)
192
196
result_dict = result .to_dict ()
193
- assert result_dict == {
194
- "result" : "error" ,
195
- "reason" : "hash mismatch" ,
196
- "hash" : "currenthash123" ,
197
- }
197
+ assert result_dict == {"result" : "error" , "reason" : "hash mismatch" }
198
198
199
199
200
200
def test_file_range ():
0 commit comments