def test_throw_except_initial(): try: ClosedRange(8, 3) except RuntimeError: return fail("not throwing")
def test_connected_to_other_closed_range(range_a, range_b, actual): closed_range1 = ClosedRange(*range_a) closed_range2 = ClosedRange(*range_b) assert closed_range1.is_connected_to(closed_range2) is actual
def test_equals_other_closed_range(): closed_range1 = ClosedRange(3, 8) assert closed_range1 == ClosedRange(3, 8) assert closed_range1 != ClosedRange(4, 5)
def test_contains_between_lower_to_upper(): range_interval = ClosedRange(3, 8) assert range_interval.is_contains(5) is True assert range_interval.is_contains(-1) is False
def test_convert_able_to_string(): range_interval = ClosedRange(3, 8) assert range_interval.toString() == "[3,8]"
def test_create_range(lower_endpoint, upper_endpoint): range_interval = ClosedRange(lower_endpoint, upper_endpoint) assert range_interval.get_lower_endpoint() == lower_endpoint assert range_interval.get_upper_endpoint() == upper_endpoint
def initialize(a, b): cr = ClosedRange(a, b) return cr
def test_数字が文字列型として渡された場合は許容する(self): cr = ClosedRange('3', '8') assert cr.closed_range == [3, 8]
def test_数字以外が入力されたらValueErrorを返す(self): try: cr = ClosedRange('a', 'b') except ValueError: cr = None assert cr is None