Пример #1
0
 def test_termial_function_error(self, n: int) -> None:
     """Test termial function."""
     with pytest.raises(ValueError):
         State._termial_function(n)
Пример #2
0
 def test_termial_function_solution(self, n: int) -> None:
     """Test solution to termial function."""
     x = State._termial_function(n)
     assert State._termial_function_solution(
         x - 1) <= n <= State._termial_function_solution(x)
Пример #3
0
 def test_termial_function_compute(self, n: int) -> None:
     """Test termial function - compute explicitly results."""
     x = State._termial_function(n)
     assert x == sum(range(n + 1))