def test_added_once(): assert { "ref": PR("foo") } == merge( {}, {"ref": PR("foo")}, {}, ) assert { "ref": PR("foo") } == merge( {}, {}, {"ref": PR("foo")}, )
def test_edited_once(): assert { "ref": PR("bar") } == merge( {"ref": PR("foo")}, {"ref": PR("foo")}, {"ref": PR("bar")}, ) assert { "ref": PR("bar") } == merge( {"ref": PR("foo")}, {"ref": PR("bar")}, {"ref": PR("foo")}, )
def test_edit_nested_both_different_with_nested_pr_plus(): assert { "ref": PR("ref"), "deeper": {"ref2": PR("ref2"), "foo": "after", "bar": "after"}, } == merge( { "ref": PR("ref"), "deeper": {"ref2": PR("ref2"), "foo": "before", "bar": "before"}, }, { "ref": PR("ref"), "deeper": {"ref2": PR("ref2"), "foo": "after", "bar": "before"}, }, { "ref": PR("ref"), "deeper": {"ref2": PR("ref2"), "foo": "before", "bar": "after"}, }, )
def test_edited_twice(): with pytest.raises(DictConflictException): merge({"foo": PR("ZBRLA")}, {"foo": PR("DOH")}, {"foo": PR("NEH")})
def test_added_twice(): with pytest.raises(DictConflictException): merge({}, {"foo": PR("DOH")}, {"foo": PR("NEH")})
def test_deleted_twice(): assert {} == merge( {"ref": PR("foo")}, {}, {}, )
def test_edit_both_different_with_pr(): assert {"ref": PR("ref"), "foo": "after", "bar": "after"} == merge( {"ref": PR("ref"), "foo": "before", "bar": "before"}, {"ref": PR("ref"), "foo": "after", "bar": "before"}, {"ref": PR("ref"), "foo": "before", "bar": "after"}, )