Jan-08-2024, 05:17 PM
Hello again,
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.
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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
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() |