# Path: tt/errors/arguments.py
# class InvalidArgumentValueError(ArgumentError):
#     """An exception type for invalid argument values.
# 
#     Here's an example where we pass a non-power of 2 number of values when
#     attempting to create a :class:`TruthTable \
#     <tt.tables.truth_table.TruthTable>`::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable(from_values='01x')
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentValueError: Must specify a number \
# of input values that is a power of 2
# 
#     """
# 
# Path: tt/transformations/utils.py
# _DEFAULT_TIMES = 1
# def ensure_bexpr(expr):
#     def __init__(self, times=_DEFAULT_TIMES):
#     def times(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __lt__(self, other):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self, fn, next_transformation=None, times=_DEFAULT_TIMES):
#     def __call__(self, expr):
#     def __rshift__(self, other):
#     def __lshift__(self, other):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def compose(self, other):
#     def fn(self):
#     def next_transformation(self):
#     def modify(self, other):
#     def __init__(self, times):
#     def modify(self, other):
# def tt_compose(*fns):
# class RepeatableAction(object):
# class ComposedTransformation(RepeatableAction):
# class AbstractTransformationModifier(object):
# class repeat(AbstractTransformationModifier, RepeatableAction):


import unittest
from tt.errors import (
    InvalidArgumentValueError)
from tt.transformations import (
    forever,
    RepeatableAction)
"""Tests for the RepeatableAction class."""




class TestUtilsRepeatableAction(unittest.TestCase):

    def test_invalid_times(self):
        """Test attempting to init with an invalid number of times."""
        with self.assertRaises(InvalidArgumentValueError):
            RepeatableAction(0)

        class _AlwaysLessThan(object):
            def __lt__(self, other):
                return True

        with self.assertRaises(InvalidArgumentValueError):
            RepeatableAction(_AlwaysLessThan())

    def test_comparing_objects(self):
        """Test comparing two instances."""
        r1 = RepeatableAction(1)
        r2 = RepeatableAction(50)

# Path: tt/errors/arguments.py
# class InvalidArgumentValueError(ArgumentError):
#     """An exception type for invalid argument values.
# 
#     Here's an example where we pass a non-power of 2 number of values when
#     attempting to create a :class:`TruthTable \
#     <tt.tables.truth_table.TruthTable>`::
# 
#         >>> from tt import TruthTable
#         >>> t = TruthTable(from_values='01x')
#         Traceback (most recent call last):
#             ...
#         tt.errors.arguments.InvalidArgumentValueError: Must specify a number \
# of input values that is a power of 2
# 
#     """
# 
# Path: tt/transformations/utils.py
# _DEFAULT_TIMES = 1
# def ensure_bexpr(expr):
#     def __init__(self, times=_DEFAULT_TIMES):
#     def times(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __lt__(self, other):
#     def __str__(self):
#     def __repr__(self):
#     def __init__(self, fn, next_transformation=None, times=_DEFAULT_TIMES):
#     def __call__(self, expr):
#     def __rshift__(self, other):
#     def __lshift__(self, other):
#     def __str__(self):
#     def __repr__(self):
#     def __hash__(self):
#     def __eq__(self, other):
#     def __ne__(self, other):
#     def compose(self, other):
#     def fn(self):
#     def next_transformation(self):
#     def modify(self, other):
#     def __init__(self, times):
#     def modify(self, other):
# def tt_compose(*fns):
# class RepeatableAction(object):
# class ComposedTransformation(RepeatableAction):
# class AbstractTransformationModifier(object):
# class repeat(AbstractTransformationModifier, RepeatableAction):


# Path: tt/tests/unit/transformations/test_utils_repeatable_action.py
import unittest
from tt.errors import (
    InvalidArgumentValueError)
from tt.transformations import (
    forever,
    RepeatableAction)

"""Tests for the RepeatableAction class."""




class TestUtilsRepeatableAction(unittest.TestCase):

    def test_invalid_times(self):
        """Test attempting to init with an invalid number of times."""
        with self.assertRaises(InvalidArgumentValueError):
            RepeatableAction(0)

        class _AlwaysLessThan(object):
            def __lt__(self, other):
                return True

        with self.assertRaises(InvalidArgumentValueError):
            RepeatableAction(_AlwaysLessThan())

    def test_comparing_objects(self):
        """Test comparing two instances."""
        r1 = RepeatableAction(1)
        r2 = RepeatableAction(50)

        r3 = forever