def test_parse():
    d = Interval.parse(Interval(0, 1, start_open=True, end_open=True))
    assert (d.start == 0)
    assert (d.end == 1)
    assert d.start_open
    assert d.end_open
    d = Interval.parse((0, 1))
    assert (d.start == 0)
    assert (d.end == 1)
    assert (not d.start_open)
    assert (not d.end_open)
    d = Interval.parse(1)
    assert (d.start == 1)
    assert (d.end == 1)
    assert (not d.start_open)
    assert (not d.end_open)
    with pytest.raises(Exception):
        _ = Interval.parse(None)
    with pytest.raises(Exception):
        _ = Interval.parse(None, default_inf=False)
    assert (Interval.parse(None, default_inf=True) == Interval.infinite())
    d = Interval.parse(math.inf)
    assert math.isinf(d.start)
    assert math.isinf(d.end)
    assert (d.start > 0)
    assert (d.end > 0)
    assert (not d.is_negative_infinite)
    assert (not d.is_positive_infinite)
    d = Interval.parse((- math.inf))
    assert math.isinf(d.start)
    assert math.isinf(d.end)
    assert (d.start < 0)
    assert (d.end < 0)
    assert (not d.is_negative_infinite)
    assert (not d.is_positive_infinite)
    d = Interval.parse([])
    assert d.is_empty
def test_parse():
    d = Interval.parse(Interval(0, 1, start_open=True, end_open=True))
    assert (d.start == 0)
    assert (d.end == 1)
    assert d.start_open
    assert d.end_open
    d = Interval.parse((0, 1))
    assert (d.start == 0)
    assert (d.end == 1)
    assert (not d.start_open)
    assert (not d.end_open)
    d = Interval.parse(1)
    assert (d.start == 1)
    assert (d.end == 1)
    assert (not d.start_open)
    assert (not d.end_open)
    with pytest.raises(Exception):
        _ = Interval.parse(None)
    with pytest.raises(Exception):
        _ = Interval.parse(None, default_inf=False)
    assert (Interval.parse(None, default_inf=True) == Interval.infinite())
    d = Interval.parse(math.inf)
    assert math.isinf(d.start)
    assert math.isinf(d.end)
    assert (d.start > 0)
    assert (d.end > 0)
    assert (not d.is_negative_infinite)
    assert (not d.is_positive_infinite)
    d = Interval.parse((- math.inf))
    assert math.isinf(d.start)
    assert math.isinf(d.end)
    assert (d.start < 0)
    assert (d.end < 0)
    assert (not d.is_negative_infinite)
    assert (not d.is_positive_infinite)
    d = Interval.parse([])
    assert d.is_empty