diff options
Diffstat (limited to 'tests/test_constants.py')
-rw-r--r-- | tests/test_constants.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/test_constants.py b/tests/test_constants.py new file mode 100644 index 0000000..5ce0b1a --- /dev/null +++ b/tests/test_constants.py @@ -0,0 +1,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() |