@@ -202,6 +202,22 @@ def test_merge_dicts() -> None:
202202 {"a" : True , "b" : {"x" : 123 , "y" : {"hello" : "world" }}},
203203 {"a" : False , "b" : {"y" : [], "z" : 987 }},
204204 ) == {"a" : False , "b" : {"x" : 123 , "y" : [], "z" : 987 }}
205+ assert _utils .merge_dicts (
206+ {"a" : True , "b" : "foo" },
207+ {"c" : None }
208+ ) == {"a" : True , "b" : "foo" , "c" : None }, "None value for key that is only in second object should be preserved"
209+ assert _utils .merge_dicts (
210+ {"a" : None , "b" : "foo" },
211+ {"b" : "bar" }
212+ ) == {"a" : None , "b" : "bar" }, "None value for key that is only in first object should be preserved"
213+ assert _utils .merge_dicts (
214+ {"a" : True , "b" : "foo" },
215+ {"b" : None , }
216+ ) == {"a" : True , "b" : "foo" }, "None value for key in second object should not override the value in first object"
217+ assert _utils .merge_dicts (
218+ {"a" : True , "b" : {"bar" : "baz" }},
219+ {"b" : {"bar" : "baz" , "foo" : None }, }
220+ ) == {"a" : True , "b" : {"bar" : "baz" , "foo" : None }}, "Nested None value for key that is only in second object should be preserved"
205221
206222
207223def test_clip_column () -> None :
0 commit comments