# Path: lighty/monads.py
# def handle_exception(func):
#     def wrapper(*args, **kwargs):
# def monad_operation(func):
# def monad_operator(func):
#     def wrapper(self, value):
# def monad_boolean(func):
#     def wrapper(self, value):
# def check_argument(arg):
# def monad_function(func):
#     def wrapper(self, *args, **kwargs):
# def __getattr__(self, name):
#     def __init__(self, value):
#     def create_copy(self, operator, operand):
#     def __len__(self):
#     def __iter__(self):
#     def __getitem__(self, *args):
#     def __delitem__(self, *args):
#     def __setitem__(self, *args):
#     def __call__(self, *args, **kwargs):
#     def __str__(self):
#     def __index__(self):
#     def __init__(self, value):
#     def __len__(self):
#     def __iter__(self):
#     def __index__(self):
#     def __nonzero__(self):
#     def __init__(self, value, traceback=None):
# BOOLEAN_OPERATORS = set((operator.__lt__, operator.__le__, operator.__eq__,
#                          operator.__ge__, operator.__gt__, ))
#     EMPTY_ITER = itertools.cycle('')
# class ValueMonad(functor.BaseFunctor):
# class NoneMonad(ValueMonad):
# class ErrorMonad(NoneMonad):


import unittest
from lighty import monads

class MonadTestCase(unittest.TestCase):
    '''Test case for partial template execution
    '''

    def testNumberComparision(self):
        '''Test comparing monad with number'''
        monad = monads.ValueMonad(10)
        assert monad == 10, 'Number __eq__ error: %s' % monad
        assert monad > 9, 'Number __gt__ error: %s' % monad
        assert monad >= 10, 'Number __ge__ error: %s' % monad
        assert monad < 11, 'Number __lt__ error: %s' % monad
        assert monad <= 10, 'Number __le__ error: %s' % monad

    def testNumberActions(self):
        '''Test monad numeric operations'''
        monad = monads.ValueMonad(10)
        assert monad + 10 == 20, 'Number + error: %s' % (monad + 10)
        assert monad - 5 == 5, 'Number - error: %s' % (monad - 5)
        assert monad / 2 == 5, 'Number / error: %s' % (monad / 2)
        assert monad * 2 == 20, 'Number * error: %s' % (monad * 2)
        assert monad ** 2 == 100, 'Number pow error: %s' % (monad ** 2)
        assert monad << 1 == 10 << 1, 'Number << error: %s' % (monad << 1)
        assert monad >> 1 == 10 >> 1, 'Number >> error: %s' % (monad >> 1)

    def testNumberSeq(self):
        '''Test accessing to number as a scequnce inside monad'''
        monad = monads.ValueMonad(10)
        assert len(monad) == 1, 'Number len error: %s' % len(monad)
        assert monad[0] == 10, 'Number [0] error: %s' % monad[0]

# Path: lighty/monads.py
# def handle_exception(func):
#     def wrapper(*args, **kwargs):
# def monad_operation(func):
# def monad_operator(func):
#     def wrapper(self, value):
# def monad_boolean(func):
#     def wrapper(self, value):
# def check_argument(arg):
# def monad_function(func):
#     def wrapper(self, *args, **kwargs):
# def __getattr__(self, name):
#     def __init__(self, value):
#     def create_copy(self, operator, operand):
#     def __len__(self):
#     def __iter__(self):
#     def __getitem__(self, *args):
#     def __delitem__(self, *args):
#     def __setitem__(self, *args):
#     def __call__(self, *args, **kwargs):
#     def __str__(self):
#     def __index__(self):
#     def __init__(self, value):
#     def __len__(self):
#     def __iter__(self):
#     def __index__(self):
#     def __nonzero__(self):
#     def __init__(self, value, traceback=None):
# BOOLEAN_OPERATORS = set((operator.__lt__, operator.__le__, operator.__eq__,
#                          operator.__ge__, operator.__gt__, ))
#     EMPTY_ITER = itertools.cycle('')
# class ValueMonad(functor.BaseFunctor):
# class NoneMonad(ValueMonad):
# class ErrorMonad(NoneMonad):


# Path: tests/monad.py
import unittest
from lighty import monads


class MonadTestCase(unittest.TestCase):
    '''Test case for partial template execution
    '''

    def testNumberComparision(self):
        '''Test comparing monad with number'''
        monad = monads.ValueMonad(10)
        assert monad == 10, 'Number __eq__ error: %s' % monad
        assert monad > 9, 'Number __gt__ error: %s' % monad
        assert monad >= 10, 'Number __ge__ error: %s' % monad
        assert monad < 11, 'Number __lt__ error: %s' % monad
        assert monad <= 10, 'Number __le__ error: %s' % monad

    def testNumberActions(self):
        '''Test monad numeric operations'''
        monad = monads.ValueMonad(10)
        assert monad + 10 == 20, 'Number + error: %s' % (monad + 10)
        assert monad - 5 == 5, 'Number - error: %s' % (monad - 5)
        assert monad / 2 == 5, 'Number / error: %s' % (monad / 2)
        assert monad * 2 == 20, 'Number * error: %s' % (monad * 2)
        assert monad ** 2 == 100, 'Number pow error: %s' % (monad ** 2)
        assert monad << 1 == 10 << 1, 'Number << error: %s' % (monad << 1)
        assert monad >> 1 == 10 >> 1, 'Number >> error: %s' % (monad >> 1)

    def testNumberSeq(self):
        '''Test accessing to number as a scequnce inside monad'''
        monad = monads.ValueMonad(10)
        assert len(monad) == 1, 'Number len error: %s' % len(monad)
        assert monad[0] == 10, 'Number [0] error: %s' % monad[0]

        assert isinstance(monad[1], monads.NoneMonad), ('Number [1] error' %