# Path: sider/threadlocal.py
# class LocalDict(collections.MutableMapping):
#     def __init__(self, mapping=[], **keywords):
#     def current(self):
#     def __len__(self):
#     def __iter__(self):
#     def __contains__(self, value):
#     def __getitem__(self, key):
#     def __setitem__(self, key, value):
#     def __delitem__(self, key):
#     def copy(self):
#     def get(self, key, default=None):
#     def has_key(self, key):
#     def items(self):
#     def iteritems(self):
#     def iterkeys(self):
#     def itervalues(self):
#     def keys(self):
#     def values(self):
#     def clear(self):
#     def pop(self, key, *args):
#     def popitem(self):
#     def setdefault(self, key, default=None):
#     def update(self, mapping, **keywords):


import threading
    import greenlet
from sider.threadlocal import LocalDict, get_ident
    assert result == [123, 456]
    if greenlet:
        result = [None, None]
        coro_test(run, (123, 0), (456, 1))
        assert result == [123, 456]


def test_local_dict():
    local = LocalDict()
    result = [None, None]
    def run():
        value = yield
        local['a'] = value
        result_idx = yield
        result[result_idx] = (
            len(local), list(iter(local)), 'a' in local, 'b' in local,
            local['a'], local.copy(), local.get('a', 1), local.get('b', 2),
            'a' in local, 'b' in local, list(local.items()),
            list(local.iteritems()), list(local.iterkeys()),
            list(local.itervalues()), list(local.keys()), list(local.values()),
        )
    def assert_expects(result, value):
        assert result[0] == 1
        assert result[1] == ['a']
        assert result[2]
        assert not result[3]
        assert result[4] == value
        assert result[5] == {'a': value}
        assert result[6] == value
        assert result[7] == 2

# Path: sider/threadlocal.py
# class LocalDict(collections.MutableMapping):
#     def __init__(self, mapping=[], **keywords):
#     def current(self):
#     def __len__(self):
#     def __iter__(self):
#     def __contains__(self, value):
#     def __getitem__(self, key):
#     def __setitem__(self, key, value):
#     def __delitem__(self, key):
#     def copy(self):
#     def get(self, key, default=None):
#     def has_key(self, key):
#     def items(self):
#     def iteritems(self):
#     def iterkeys(self):
#     def itervalues(self):
#     def keys(self):
#     def values(self):
#     def clear(self):
#     def pop(self, key, *args):
#     def popitem(self):
#     def setdefault(self, key, default=None):
#     def update(self, mapping, **keywords):


# Path: sidertests/test_threadlocal.py
import threading
    import greenlet
from sider.threadlocal import LocalDict, get_ident

    assert result == [123, 456]
    if greenlet:
        result = [None, None]
        coro_test(run, (123, 0), (456, 1))
        assert result == [123, 456]


def test_local_dict():
    local = LocalDict()
    result = [None, None]
    def run():
        value = yield
        local['a'] = value
        result_idx = yield
        result[result_idx] = (
            len(local), list(iter(local)), 'a' in local, 'b' in local,
            local['a'], local.copy(), local.get('a', 1), local.get('b', 2),
            'a' in local, 'b' in local, list(local.items()),
            list(local.iteritems()), list(local.iterkeys()),
            list(local.itervalues()), list(local.keys()), list(local.values()),
        )
    def assert_expects(result, value):
        assert result[0] == 1
        assert result[1] == ['a']
        assert result[2]
        assert not result[3]
        assert result[4] == value
        assert result[5] == {'a': value}
        assert result[6] == value
        assert result[7] == 2

        assert result[8]