test_utils.py 898 B

123456789101112131415161718192021222324252627282930313233
  1. # -*- coding: utf-8 -*-
  2. """Basic test suite.
  3. There are some 'noqa: F401' in this file to just test the isort import sorting
  4. along with the code formatter.
  5. """
  6. import __future__ # noqa: F401
  7. import json # noqa: F401
  8. from os import path # noqa: F401
  9. from re import IGNORECASE, sub # noqa: F401
  10. import my_module # noqa: F401
  11. from my_module.utils import add_two_numbers
  12. import pytest
  13. import requests # noqa: F401
  14. class TestUtils: # noqa: D101
  15. @pytest.mark.parametrize('number_left, number_right', [
  16. (None, 1), (1, None), (None, None)
  17. ])
  18. def test_add_two_numbers_no_input(self, number_left, number_right):
  19. """Basic input validation."""
  20. with pytest.raises(ValueError):
  21. add_two_numbers(number_left, number_right)
  22. def test_add_two_numbers_regular_input(self):
  23. """Basic asserting test."""
  24. assert add_two_numbers(2, 3) == 5