# Path: testers/functor_law_tester.py
# class FunctorLawTester:  # pragma: no cover
# 
#     def __init__(self, functor, mapper1, mapper2, get_fn=identity):
#         self.functor = functor
#         self.mapper1 = mapper1
#         self.mapper2 = mapper2
#         self.get_fn = get_fn
# 
#     def _assert(self, x, y):
#         assert self.get_fn(x) == self.get_fn(y)
# 
#     def identity_law_test(self):
#         x = self.functor.map(identity)
#         y = self.functor
# 
#         self._assert(x, y)
# 
#     def composition_law_test(self):
#         mapped_functor1 = self.functor.map(self.mapper1).map(self.mapper2)
#         mapped_fuctor2 = self.functor.map(lambda value: self.mapper2(self.mapper1(value)))
#         self._assert(mapped_functor1, mapped_fuctor2)
# 
#     def test(self, run_identity_law_test=True, run_composition_law_test=True):
#         if run_identity_law_test:
#             self.identity_law_test()
#         if run_composition_law_test:
#             self.composition_law_test()
# 
# Path: testers/monad_law_tester.py
# class MonadLawTester:  # pragma: no cover
# 
#     def __init__(self, monad, value, mapper1, mapper2, get_fn=identity):
#         self.monad = monad
#         self.value = value
#         self.mapper1 = mapper1
#         self.mapper2 = mapper2
#         self.get_fn = get_fn
# 
#     def _assert(self, x, y):
#         assert self.get_fn(x) == self.get_fn(y)
# 
#     def associativity_test(self):
#         x = self.monad(self.value).bind(self.mapper1).bind(self.mapper2)
#         y = self.monad(self.value).bind(lambda value: self.mapper2(value).bind(self.mapper1))
# 
#         self._assert(x, y)
# 
#     def left_unit_test(self):
#         self._assert(self.monad(self.value).bind(self.mapper1), self.mapper1(self.value))
# 
#     def right_unit_test(self):
#         self._assert(self.monad(self.value).bind(lambda value: self.monad(value)), self.monad(self.value))
# 
#     def test(self, run_associativity_law_test=True, run_left_law_test=True, run_right_law_test=True):
#         if run_associativity_law_test:
#             self.associativity_test()
#         if run_left_law_test:
#             self.left_unit_test()
#         if run_right_law_test:
#             self.right_unit_test()
# 
# Path: pymonet/task.py
# class Task:
#     """
#     Task are data-type for handle execution of functions (in lazy way)
#     transform results of this function and handle errors.
#     """
# 
#     def __init__(self, fork):
#         """
#         :param fork: function to call during fork
#         :type fork: Function(reject, resolve) -> Any
#         """
#         self.fork = fork
# 
#     @classmethod
#     def of(cls, value):
#         """
#         Return resolved Task with stored value argument.
# 
#         :param value: value to store in Task
#         :type value: A
#         :returns: resolved Task
#         :rtype: Task[Function(_, resolve) -> A]
#         """
#         return Task(lambda _, resolve: resolve(value))
# 
#     @classmethod
#     def reject(cls, value):
#         """
#         Return rejected Task with stored value argument.
# 
#         :param value: value to store in Task
#         :type value: A
#         :returns: rejected Task
#         :rtype: Task[Function(reject, _) -> A]
#         """
#         return Task(lambda reject, _: reject(value))
# 
#     def map(self, fn):
#         """
#         Take function, store it and call with Task value during calling fork function.
#         Return new Task with result of called.
# 
#         :param fn: mapper function
#         :type fn: Function(value) -> B
#         :returns: new Task with mapped resolve attribute
#         :rtype: Task[Function(resolve, reject -> A | B]
#         """
#         def result(reject, resolve):
#             return self.fork(
#                 lambda arg: reject(arg),
#                 lambda arg: resolve(fn(arg))
#             )
# 
#         return Task(result)
# 
#     def bind(self, fn):
#         """
#         Take function, store it and call with Task value during calling fork function.
#         Return result of called.
# 
#         :param fn: mapper function
#         :type fn: Function(value) -> Task[reject, mapped_value]
#         :returns:  new Task with mapper resolve attribute
#         :rtype: Task[reject, mapped_value]
#         """
#         def result(reject, resolve):
#             return self.fork(
#                 lambda arg: reject(arg),
#                 lambda arg: fn(arg).fork(reject, resolve)
#             )
# 
#         return Task(result)
# 
# Path: pymonet/utils.py
# def identity(value: T) -> T:
#     """
#     Return first argument.
# 
#     :param value:
#     :type value: Any
#     :returns:
#     :rtype: Any
#     """
#     return value
# 
# def increase(value: int) -> int:
#     """
#     Return increased by 1 argument.
# 
#     :param value:
#     :type value: Int
#     :returns:
#     :rtype: Int
#     """
#     return value + 1


from testers.functor_law_tester import FunctorLawTester
from testers.monad_law_tester import MonadLawTester
from pymonet.task import Task
from pymonet.utils import identity, increase
from hypothesis import given
from hypothesis.strategies import integers
import pytest





class TaskSpy:

    def resolved(self, value):
        return value

    def rejected(self, value):
        return value

    def mapper(self, arg):
        return arg + 1

    def side_effect(self, arg):  # remove?
        return arg

    def binder(self, arg):

# Path: testers/functor_law_tester.py
# class FunctorLawTester:  # pragma: no cover
# 
#     def __init__(self, functor, mapper1, mapper2, get_fn=identity):
#         self.functor = functor
#         self.mapper1 = mapper1
#         self.mapper2 = mapper2
#         self.get_fn = get_fn
# 
#     def _assert(self, x, y):
#         assert self.get_fn(x) == self.get_fn(y)
# 
#     def identity_law_test(self):
#         x = self.functor.map(identity)
#         y = self.functor
# 
#         self._assert(x, y)
# 
#     def composition_law_test(self):
#         mapped_functor1 = self.functor.map(self.mapper1).map(self.mapper2)
#         mapped_fuctor2 = self.functor.map(lambda value: self.mapper2(self.mapper1(value)))
#         self._assert(mapped_functor1, mapped_fuctor2)
# 
#     def test(self, run_identity_law_test=True, run_composition_law_test=True):
#         if run_identity_law_test:
#             self.identity_law_test()
#         if run_composition_law_test:
#             self.composition_law_test()
# 
# Path: testers/monad_law_tester.py
# class MonadLawTester:  # pragma: no cover
# 
#     def __init__(self, monad, value, mapper1, mapper2, get_fn=identity):
#         self.monad = monad
#         self.value = value
#         self.mapper1 = mapper1
#         self.mapper2 = mapper2
#         self.get_fn = get_fn
# 
#     def _assert(self, x, y):
#         assert self.get_fn(x) == self.get_fn(y)
# 
#     def associativity_test(self):
#         x = self.monad(self.value).bind(self.mapper1).bind(self.mapper2)
#         y = self.monad(self.value).bind(lambda value: self.mapper2(value).bind(self.mapper1))
# 
#         self._assert(x, y)
# 
#     def left_unit_test(self):
#         self._assert(self.monad(self.value).bind(self.mapper1), self.mapper1(self.value))
# 
#     def right_unit_test(self):
#         self._assert(self.monad(self.value).bind(lambda value: self.monad(value)), self.monad(self.value))
# 
#     def test(self, run_associativity_law_test=True, run_left_law_test=True, run_right_law_test=True):
#         if run_associativity_law_test:
#             self.associativity_test()
#         if run_left_law_test:
#             self.left_unit_test()
#         if run_right_law_test:
#             self.right_unit_test()
# 
# Path: pymonet/task.py
# class Task:
#     """
#     Task are data-type for handle execution of functions (in lazy way)
#     transform results of this function and handle errors.
#     """
# 
#     def __init__(self, fork):
#         """
#         :param fork: function to call during fork
#         :type fork: Function(reject, resolve) -> Any
#         """
#         self.fork = fork
# 
#     @classmethod
#     def of(cls, value):
#         """
#         Return resolved Task with stored value argument.
# 
#         :param value: value to store in Task
#         :type value: A
#         :returns: resolved Task
#         :rtype: Task[Function(_, resolve) -> A]
#         """
#         return Task(lambda _, resolve: resolve(value))
# 
#     @classmethod
#     def reject(cls, value):
#         """
#         Return rejected Task with stored value argument.
# 
#         :param value: value to store in Task
#         :type value: A
#         :returns: rejected Task
#         :rtype: Task[Function(reject, _) -> A]
#         """
#         return Task(lambda reject, _: reject(value))
# 
#     def map(self, fn):
#         """
#         Take function, store it and call with Task value during calling fork function.
#         Return new Task with result of called.
# 
#         :param fn: mapper function
#         :type fn: Function(value) -> B
#         :returns: new Task with mapped resolve attribute
#         :rtype: Task[Function(resolve, reject -> A | B]
#         """
#         def result(reject, resolve):
#             return self.fork(
#                 lambda arg: reject(arg),
#                 lambda arg: resolve(fn(arg))
#             )
# 
#         return Task(result)
# 
#     def bind(self, fn):
#         """
#         Take function, store it and call with Task value during calling fork function.
#         Return result of called.
# 
#         :param fn: mapper function
#         :type fn: Function(value) -> Task[reject, mapped_value]
#         :returns:  new Task with mapper resolve attribute
#         :rtype: Task[reject, mapped_value]
#         """
#         def result(reject, resolve):
#             return self.fork(
#                 lambda arg: reject(arg),
#                 lambda arg: fn(arg).fork(reject, resolve)
#             )
# 
#         return Task(result)
# 
# Path: pymonet/utils.py
# def identity(value: T) -> T:
#     """
#     Return first argument.
# 
#     :param value:
#     :type value: Any
#     :returns:
#     :rtype: Any
#     """
#     return value
# 
# def increase(value: int) -> int:
#     """
#     Return increased by 1 argument.
# 
#     :param value:
#     :type value: Int
#     :returns:
#     :rtype: Int
#     """
#     return value + 1


# Path: tests/test_task.py
from testers.functor_law_tester import FunctorLawTester
from testers.monad_law_tester import MonadLawTester
from pymonet.task import Task
from pymonet.utils import identity, increase
from hypothesis import given
from hypothesis.strategies import integers
import pytest






class TaskSpy:

    def resolved(self, value):
        return value

    def rejected(self, value):
        return value

    def mapper(self, arg):
        return arg + 1

    def side_effect(self, arg):  # remove?
        return arg

    def binder(self, arg):

        return Task(lambda reject, resolve: resolve(arg + 1))