#!/usr/bin/python3 # -*- coding: utf-8 -*- """ Run at shell: $ nosetests $ nosetests yourfile.py Note: Debugging requires the below line, and: $ nosetests -s yourfile.py """ import pudb # type: ignore pu.db # type: ignore import nose # type: ignore # content of test_sample.py def func(x: int) -> int: return x + 1 def test_answer() -> None: x = 3 assert func(3) == 4, "failed" def test_answer2() -> None: x = 3 assert func(3) == 5, "failed" # testing python itself... def test_sum() -> None: assert sum([1, 2, 3]) == 6, "Should be 6" def test_sum_tuple() -> None: assert sum((1, 2, 2)) == 6, "Should be 6" class TestClass: def test_one(self) -> None: x = "this" assert "h" in x def test_two(self) -> None: x = "hello" assert hasattr(x, "check") # to quit with sys.exit 0 or 1 if __name__ == "__main__": # This does not work with debugging, but above does. nose.main()