55class TestCommentSpellCheck (unittest .TestCase ):
66 @classmethod
77 def setUpClass (self ):
8- print ( " \n Setting up comment_spell_check tests")
8+ """Setting up comment_spell_check tests"""
99
1010 @classmethod
1111 def tearDownClass (cls ):
12- print ( " \n Tearing down comment_spell_check tests")
12+ """Tearing down comment_spell_check tests"""
1313
1414 def test_basic (self ):
15- print ( " \n Command_spell_check: Basic Test" )
15+ """ Basic test"""
1616 runresult = subprocess .run (
1717 [
1818 "python" ,
@@ -26,13 +26,12 @@ def test_basic(self):
2626 ],
2727 stdout = subprocess .PIPE ,
2828 )
29- if runresult .returncode :
30- self .fail ("\n Basic Test: FAIL" )
31- output_string = str (runresult .stdout )
32- print ("\n Test output:" , output_string )
29+ self .assertEqual (
30+ runresult .returncode , 0 , "Basic test FAIL: " + str (runresult .stdout )
31+ )
3332
3433 def test_codebase (self ):
35- print ( " \n Comment_spell_check: Code Base Test" )
34+ """ Code base test"""
3635 runresult = subprocess .run (
3736 [
3837 "python" ,
@@ -48,13 +47,12 @@ def test_codebase(self):
4847 ],
4948 stdout = subprocess .PIPE ,
5049 )
51- if runresult .returncode :
52- self .fail ("\n Code Base Test: FAIL" )
53- output_string = str (runresult .stdout )
54- print ("\n Test output:" , output_string )
50+ self .assertEqual (
51+ runresult .returncode , 0 , "Code test FAIL: " + str (runresult .stdout )
52+ )
5553
5654 def test_version (self ):
57- print ( " \n Comment_spell_check: Version Test" )
55+ """ Version test"""
5856 runresult = subprocess .run (
5957 [
6058 "python" ,
@@ -63,8 +61,9 @@ def test_version(self):
6361 ],
6462 stdout = subprocess .PIPE ,
6563 )
64+ self .assertEqual (runresult .returncode , 0 , "Version test FAIL" )
65+
6666 version_string = str (runresult .stdout )
67- if runresult .returncode :
68- self .fail ("Version Test: FAIL" )
69- if "unknown" in version_string :
70- self .fail ("Version Test: version string contains 'unknown'" )
67+ self .assertNotEqual (
68+ version_string , "unknown" , "version string contains 'unknown'"
69+ )
0 commit comments