# Path: mididings/overload.py
# def call(args, kwargs, funcs, name=None):
#     def __init__(self, name, docstring):
#     def add(self, f):
#     def __call__(self, *args, **kwargs):
# def _register_overload(f, docstring):
# def mark(f, docstring=None):
#     def call_overload(*args, **kwargs):
#     def __init__(self, *partial_args):
#     def __call__(self, f):
#         def call_overload(*args, **kwargs):
# class _Overload(object):
# class partial(object):


    import unittest2 as unittest
    import unittest
from mididings import overload
        self.registry_bak = overload._registry.copy()

    def tearDown(self):
        # yuck!
        overload._registry = self.registry_bak

    def test_call(self):
        funcs = [
            lambda a: 1,
            lambda a, b: 2,
        ]

        self.assertEqual(overload.call([23], {}, funcs), 1)
        self.assertEqual(overload.call([], {'a': 23}, funcs), 1)
        self.assertEqual(overload.call([23, 42], {}, funcs), 2)
        self.assertEqual(overload.call([23], {'b': 42}, funcs), 2)
        self.assertEqual(overload.call([], {'a': 23, 'b': 42}, funcs), 2)

        with self.assertRaises(TypeError):
            overload.call([], {}, funcs)
        with self.assertRaises(TypeError):
            overload.call([23, 42, 69], {}, funcs)
        with self.assertRaises(TypeError):
            overload.call([23, 42], {'c': 69}, funcs)

    def test_mark(self):
        @overload.mark
        def foo(a):
            return 1


# Path: mididings/overload.py
# def call(args, kwargs, funcs, name=None):
#     def __init__(self, name, docstring):
#     def add(self, f):
#     def __call__(self, *args, **kwargs):
# def _register_overload(f, docstring):
# def mark(f, docstring=None):
#     def call_overload(*args, **kwargs):
#     def __init__(self, *partial_args):
#     def __call__(self, f):
#         def call_overload(*args, **kwargs):
# class _Overload(object):
# class partial(object):


# Path: tests/test_overload.py
    import unittest2 as unittest
    import unittest
from mididings import overload

        self.registry_bak = overload._registry.copy()

    def tearDown(self):
        # yuck!
        overload._registry = self.registry_bak

    def test_call(self):
        funcs = [
            lambda a: 1,
            lambda a, b: 2,
        ]

        self.assertEqual(overload.call([23], {}, funcs), 1)
        self.assertEqual(overload.call([], {'a': 23}, funcs), 1)
        self.assertEqual(overload.call([23, 42], {}, funcs), 2)
        self.assertEqual(overload.call([23], {'b': 42}, funcs), 2)
        self.assertEqual(overload.call([], {'a': 23, 'b': 42}, funcs), 2)

        with self.assertRaises(TypeError):
            overload.call([], {}, funcs)
        with self.assertRaises(TypeError):
            overload.call([23, 42, 69], {}, funcs)
        with self.assertRaises(TypeError):
            overload.call([23, 42], {'c': 69}, funcs)

    def test_mark(self):
        @overload.mark
        def foo(a):
            return 1


        @overload.mark