def test_init():

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

    # make sure no positional args conflict with possible kwdargs
    if PY2 and sys.version_info >= (2, 7, 1) or PY3 and (3, 2) >= sys.version_info:
        assert list(OrderedDict(self=42).items()) == [('self', 42)]
        assert list(OrderedDict(other=42).items()) == [('other', 42)]

    with pytest.raises(TypeError):
        OrderedDict(42)
    with pytest.raises(TypeError):
        OrderedDict((), ())
    with pytest.raises(TypeError):
        OrderedDict.__init__()

    # Make sure that direct calls to __init__ do not clear previous contents
    d = OrderedDict([('a', 1), ('b', 2), ('c', 3), ('d', 44), ('e', 55)])
    d.__init__([('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)])
dataset/ETHPy150Open schematics/schematics/tests/test_ordered_dict.py/test_init/swapped operands of `>=`