def test_tuples_construction():
    d = IndexedDict([(1, 2), (3, 4)])
    assert list(d) == [1, 3]  # Must have correct order
    assert_internal_state(d)
def test_clear():
    d = IndexedDict(a=1, b=2, c=3)
    d.clear()
    assert len(d) == 0
    assert list(d) == []
    assert_internal_state(d)
def test_popitem_empty():
    d = IndexedDict()
    with pytest.raises(KeyError):
        d.popitem()
def test_kwargs_construction():
    d = IndexedDict(a=1, b=2, c=3)
    assert set(d) == set("abc")  # Not necessarily ordered for python < 3.6
    assert_internal_state(d)
def test_fast_pop_empty():
    d = IndexedDict()
    with pytest.raises(IndexError):
        d.fast_pop()
def test_dict_construction():
    d = IndexedDict({1: 2, 3: 4})
    assert set(d) == {1, 3}  # Not necessarily ordered for python < 3.6
    assert_internal_state(d)
def test_pop_empty_no_default():
    d = IndexedDict()
    with pytest.raises(IndexError):
        d.pop()
def test_pop_empty_default():
    d = IndexedDict()
    assert d.pop(d="XXX") == "XXX"
def test_empty_construction():
    d = IndexedDict()
    assert list(d) == []
    assert_internal_state(d)
def d(request):
	ret = IndexedDict([(chr(ord("a") + i), 10 + i) for i in range(5)])
	request.addfinalizer(lambda: assert_internal_state(ret))
	return ret
def test_repr():
	d = IndexedDict()
	d[1] = "X"
	d["Y"] = 2
	d[None] = None
	assert repr(d) == "IndexedDict([(1, 'X'), ('Y', 2), (None, None)])"