Jan-08-2024, 05:52 PM
(Jan-08-2024, 05:17 PM)RockBlok Wrote: Hello again,Have you tried command line interface from documentation? https://docs.python.org/3/library/unitte...-interface
I found the unittest documentation and put together this simple scenario based on a tutorial I'm working through.
My question: Is it possible to test a single case instead of both?
Ie.. if I wanted to choose just to run the test_True case. I see there are test skip options in the documentation, I couldn't find anything to test only a specific case.
import unittest def isDivisible(x, y): #is x evenly divisible by y? return x % y == 0 class Bool_Unit_Testing(unittest.TestCase): def test_True(self): self.assertEqual(isDivisible(2,2),True) def test_False(self): self.assertEqual(isDivisible(2,3),False) if __name__ == "__main__": unittest.main()
python -m unittest file_name.class_name.function_nameessentially how you call it.