Skip to content

Commit

Permalink
Merge pull request #52 from dave3d/MakeTestsPythonic
Browse files Browse the repository at this point in the history
Make the tests more pythonic
  • Loading branch information
dave3d authored Oct 17, 2023
2 parents 20ac538 + 80311c3 commit c1609e7
Showing 1 changed file with 14 additions and 19 deletions.
33 changes: 14 additions & 19 deletions tests/test_comment_spell_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,19 @@
class TestCommentSpellCheck(unittest.TestCase):
@classmethod
def setUpClass(self):
print("\nSetting up comment_spell_check tests")
"""Setting up comment_spell_check tests"""

@classmethod
def tearDownClass(cls):
print("\nTearing down comment_spell_check tests")
"""Tearing down comment_spell_check tests"""

def test_basic(self):
print("\nCommand_spell_check: Basic Test")
"""Basic test"""
runresult = subprocess.run(
[
"python",
"comment_spell_check.py",
"--verbose",
"--miss",
"--dict",
"tests/dict.txt",
"--prefix",
Expand All @@ -26,18 +26,15 @@ def test_basic(self):
],
stdout=subprocess.PIPE,
)
if runresult.returncode:
self.fail("\nBasic Test: FAIL")
output_string = str(runresult.stdout)
print("\nTest output:", output_string)
self.assertEqual(runresult.returncode, 0, runresult.stdout)

def test_codebase(self):
print("\nComment_spell_check: Code Base Test")
"""Code base test"""
runresult = subprocess.run(
[
"python",
"comment_spell_check.py",
"--verbose",
"--miss",
"--prefix",
"myprefix",
"--suffix",
Expand All @@ -48,13 +45,10 @@ def test_codebase(self):
],
stdout=subprocess.PIPE,
)
if runresult.returncode:
self.fail("\nCode Base Test: FAIL")
output_string = str(runresult.stdout)
print("\nTest output:", output_string)
self.assertEqual(runresult.returncode, 0, runresult.stdout)

def test_version(self):
print("\nComment_spell_check: Version Test")
"""Version test"""
runresult = subprocess.run(
[
"python",
Expand All @@ -63,8 +57,9 @@ def test_version(self):
],
stdout=subprocess.PIPE,
)
self.assertEqual(runresult.returncode, 0)

version_string = str(runresult.stdout)
if runresult.returncode:
self.fail("Version Test: FAIL")
if "unknown" in version_string:
self.fail("Version Test: version string contains 'unknown'")
self.assertNotEqual(
version_string, "unknown", "version string contains 'unknown'"
)

0 comments on commit c1609e7

Please sign in to comment.