"""Tests for the constants used. 

Mainly just tests the INFTY object. 
"""

import pytest

from blc2.constants import INFTY, _Infinity

def test_infty():
    assert str(INFTY) == "infty"
    assert 1+INFTY == INFTY+1 == INFTY
    assert 1-INFTY == INFTY-1 == INFTY
    assert 4*INFTY == INFTY*4 == INFTY*0.4 == INFTY

    with pytest.raises(Exception):
        _ = INFTY * 0

    with pytest.raises(Exception):
        infty2 = _Infinity()