def test_update():

    with pytest.raises(TypeError):
        OrderedDict().update([('a', 1), ('b', 2)], None)               # too many args
    pairs = [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5)]
    od = OrderedDict()
    od.update(dict(pairs))
    assert sorted(od.items()) == pairs                                 # dict input
    od = OrderedDict()
    od.update(**dict(pairs))
    assert sorted(od.items()) == pairs                                 # kwds input
    od = OrderedDict()
    od.update(pairs)
    assert list(od.items()) == pairs                                   # pairs input
    od = OrderedDict()
    od.update([('a', 1), ('b', 2), ('c', 9), ('d', 4)], c=3, e=5)
    assert list(od.items()) == pairs                                   # mixed input

    # Issue 9137: Named argument called 'other' or 'self'
    # shouldn't be treated specially.
    if PY2 and sys.version_info >= (2, 7, 1) or PY3 and sys.version_info >= (3, 2):
        od = OrderedDict()
        od.update(self=23)
        assert list(od.items()) == [('self', 23)]
        od = OrderedDict()
        od.update(other={})
        assert list(od.items()) == [('other', {})]
        od = OrderedDict()
        od.update(red=5, blue=6, other=7, self=8)
        assert sorted(list(od.items())) == [('blue', 6), ('other', 7), ('red', 5), ('self', 8)]

    # Make sure that direct calls to update do not clear previous contents
    # add that updates items are not moved to the end
    d = OrderedDict([('a', 1), ('b', 2), ('c', 3), ('d', 44), ('e', 55)])
    d.update([('e', 5), ('f', 6)], g=7, d=4)
    assert (list(d.items()) ==
                    [('a', 1), ('b', 2), ('c', 3), ('d', 4), ('e', 5), ('f', 6), ('g', 7)])

    with pytest.raises(TypeError):
        OrderedDict().update(42)
    with pytest.raises(TypeError):
        OrderedDict().update((), ())
    with pytest.raises(TypeError):
        OrderedDict.update()
dataset/ETHPy150Open schematics/schematics/tests/test_ordered_dict.py/test_update/original