# Path: mididings/arguments.py
# class accept(object):
# class _constraint(object):
# class _any(_constraint):
# class _type_constraint(_constraint):
# class _value_constraint(_constraint):
# class nullable(_constraint):
# class sequenceof(_constraint):
# class tupleof(_constraint):
# class mappingof(_constraint):
# class flatten(_constraint):
# class each(_constraint):
# class either(_constraint):
# class transform(_constraint):
# class condition(_constraint):
# class reduce_bitmask(_constraint):
#     def __init__(self, *constraints, **kwargs):
#     def __call__(self, f):
#     def wrapper(self, f, *args, **kwargs):
# def _apply_constraint(constraint, arg, func_name, arg_name):
# def _make_constraint(c):
#     def __call__(self, arg):
#     def __init__(self, types, multiple=False):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, values):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, *what):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, fromwhat, towhat):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what, return_type=None):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, *requirements):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, *alternatives):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, function):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, function):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what):
#     def __call__(self, arg):
# def _function_repr(f):
# 
# Path: mididings/misc.py
# def flatten(arg):
# def issequence(seq, accept_string=False):
# def issequenceof(seq, t):
# def islambda(f):
# def getargspec(f):
#     def __init__(self, replacement=None):
#     def wrapper(self, f, *args, **kwargs):
#     def __call__(self, f):
#     def __new__(cls, value, name):
#     def __init__(self, value, name):
#     def __getnewargs__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __or__(self, other):
#     def __invert__(self):
# def prune_globals(g):
# def sequence_to_hex(data):
#     def __init__(self, data):
#     def __repr__(self):
# def get_terminal_size():
# class deprecated(object):
# class NamedFlag(int):
# class NamedBitMask(NamedFlag):
# class bytestring(object):


    import unittest2 as unittest
    import unittest
from mididings import arguments
from mididings import misc
# -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014  Dominic Sacré  <dominic.sacre@gmx.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#

try:
except:



class ArgumentsTestCase(unittest.TestCase):

    def test_simple(self):
        @arguments.accept(int)
        def foo(a): pass

        foo(123)

        with self.assertRaises(TypeError):
            foo()
        with self.assertRaises(TypeError):
            foo(123.456)


# Path: mididings/arguments.py
# class accept(object):
# class _constraint(object):
# class _any(_constraint):
# class _type_constraint(_constraint):
# class _value_constraint(_constraint):
# class nullable(_constraint):
# class sequenceof(_constraint):
# class tupleof(_constraint):
# class mappingof(_constraint):
# class flatten(_constraint):
# class each(_constraint):
# class either(_constraint):
# class transform(_constraint):
# class condition(_constraint):
# class reduce_bitmask(_constraint):
#     def __init__(self, *constraints, **kwargs):
#     def __call__(self, f):
#     def wrapper(self, f, *args, **kwargs):
# def _apply_constraint(constraint, arg, func_name, arg_name):
# def _make_constraint(c):
#     def __call__(self, arg):
#     def __init__(self, types, multiple=False):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, values):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, *what):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, fromwhat, towhat):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what, return_type=None):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, *requirements):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, *alternatives):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, function):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, function):
#     def __call__(self, arg):
#     def __repr__(self):
#     def __init__(self, what):
#     def __call__(self, arg):
# def _function_repr(f):
# 
# Path: mididings/misc.py
# def flatten(arg):
# def issequence(seq, accept_string=False):
# def issequenceof(seq, t):
# def islambda(f):
# def getargspec(f):
#     def __init__(self, replacement=None):
#     def wrapper(self, f, *args, **kwargs):
#     def __call__(self, f):
#     def __new__(cls, value, name):
#     def __init__(self, value, name):
#     def __getnewargs__(self):
#     def __repr__(self):
#     def __str__(self):
#     def __or__(self, other):
#     def __invert__(self):
# def prune_globals(g):
# def sequence_to_hex(data):
#     def __init__(self, data):
#     def __repr__(self):
# def get_terminal_size():
# class deprecated(object):
# class NamedFlag(int):
# class NamedBitMask(NamedFlag):
# class bytestring(object):


# Path: tests/test_arguments.py
    import unittest2 as unittest
    import unittest
from mididings import arguments
from mididings import misc

# -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014  Dominic Sacré  <dominic.sacre@gmx.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#

try:
except:



class ArgumentsTestCase(unittest.TestCase):

    def test_simple(self):
        @arguments.accept(int)
        def foo(a): pass

        foo(123)

        with self.assertRaises(TypeError):
            foo()
        with self.assertRaises(TypeError):
            foo(123.456)


        @arguments.accept(str, float)