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" ,
1919 "comment_spell_check.py" ,
20- "--verbose " ,
20+ "--miss " ,
2121 "--dict" ,
2222 "tests/dict.txt" ,
2323 "--prefix" ,
@@ -26,18 +26,15 @@ 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 (runresult .returncode , 0 , runresult .stdout )
3330
3431 def test_codebase (self ):
35- print ( " \n Comment_spell_check: Code Base Test" )
32+ """ Code base test"""
3633 runresult = subprocess .run (
3734 [
3835 "python" ,
3936 "comment_spell_check.py" ,
40- "--verbose " ,
37+ "--miss " ,
4138 "--prefix" ,
4239 "myprefix" ,
4340 "--suffix" ,
@@ -48,13 +45,10 @@ def test_codebase(self):
4845 ],
4946 stdout = subprocess .PIPE ,
5047 )
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 )
48+ self .assertEqual (runresult .returncode , 0 , runresult .stdout )
5549
5650 def test_version (self ):
57- print ( " \n Comment_spell_check: Version Test" )
51+ """ Version test"""
5852 runresult = subprocess .run (
5953 [
6054 "python" ,
@@ -63,8 +57,9 @@ def test_version(self):
6357 ],
6458 stdout = subprocess .PIPE ,
6559 )
60+ self .assertEqual (runresult .returncode , 0 )
61+
6662 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'" )
63+ self .assertNotEqual (
64+ version_string , "unknown" , "version string contains 'unknown'"
65+ )
0 commit comments