from optimizer.utils.intbounds import IntBounds


class TestIntBounds(object):
    def test_make_gt(self):
        i0 = IntBounds()

        i1 = i0.make_gt(IntBounds(10, 10))

        assert i1.lower == 11

    def test_make_gt_already_bounded(self):
        i0 = IntBounds()

        i1 = i0.make_gt(IntBounds(10, 10)).make_gt(IntBounds(0, 0))

        assert i1.lower == 11

    def test_make_lt(self):
        i0 = IntBounds()

        i1 = i0.make_lt(IntBounds(10, 10))

        assert i1.upper == 9

    def test_make_lt_already_bounded(self):
        i0 = IntBounds()

        i1 = i0.make_lt(IntBounds(0, 0)).make_lt(IntBounds(10, 10))

        assert i1.upper == -1

    def test_both_bounds(self):
        i0 = IntBounds()

        i1 = i0.make_lt(IntBounds(10, 10)).make_gt(IntBounds(0, 0))

        assert i1.upper == 9
        assert i1.lower == 1

        i2 = i0.make_gt(IntBounds(0, 0)).make_lt(IntBounds(10, 10))

        assert i2.lower == 1
        assert i2.upper == 9

    def test_make_le_already_bounded(self):
        i0 = IntBounds()
        i1 = i0.make_le(IntBounds(0, 0)).make_le(IntBounds(2, 2))

        assert i1.upper == 0

    def test_make_ge_already_bounded(self):
        i0 = IntBounds()
        i1 = i0.make_ge(IntBounds(10, 10)).make_ge(IntBounds(0, 0))

        assert i1.lower == 10

[((120, 131), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (129, 131), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((265, 276), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (274, 276), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((419, 430), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (428, 430), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((563, 574), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (572, 574), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((721, 732), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (730, 732), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((1047, 1058), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (1056, 1058), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((1213, 1224), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', ([], {}), '()\n', (1222, 1224), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((157, 174), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(10)', '(10)'], {}), '(10, 10)\n', (166, 174), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((329, 344), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(0)', '(0)'], {}), '(0, 0)\n', (338, 344), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((456, 473), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(10)', '(10)'], {}), '(10, 10)\n', (465, 473), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((625, 642), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(10)', '(10)'], {}), '(10, 10)\n', (634, 642), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((785, 800), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(0)', '(0)'], {}), '(0, 0)\n', (794, 800), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((911, 928), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(10)', '(10)'], {}), '(10, 10)\n', (920, 928), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((1108, 1123), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(2)', '(2)'], {}), '(2, 2)\n', (1117, 1123), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((1276, 1291), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(0)', '(0)'], {}), '(0, 0)\n', (1285, 1291), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((302, 319), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(10)', '(10)'], {}), '(10, 10)\n', (311, 319), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((600, 615), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(0)', '(0)'], {}), '(0, 0)\n', (609, 615), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((758, 775), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(10)', '(10)'], {}), '(10, 10)\n', (767, 775), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((886, 901), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(0)', '(0)'], {}), '(0, 0)\n', (895, 901), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((1083, 1098), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(0)', '(0)'], {}), '(0, 0)\n', (1092, 1098), False, 'from optimizer.utils.intbounds import IntBounds\n'), ((1249, 1266), 'optimizer.utils.intbounds.IntBounds', 'IntBounds', (['(10)', '(10)'], {}), '(10, 10)\n', (1258, 1266), False, 'from optimizer.utils.intbounds import IntBounds\n')]