summaryrefslogtreecommitdiff
path: root/tests/test_constants.py
blob: 5ce0b1a74b39b2f55f8525caa8fd6b9472e64b57 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
"""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()