-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_hangManEngine.py
More file actions
37 lines (29 loc) · 1.41 KB
/
test_hangManEngine.py
File metadata and controls
37 lines (29 loc) · 1.41 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
__author__ = 'Thomas Hauth, Martin Heck'
import unittest
import logging
import HangManEngine
# python -m unittest discover
# file names must start with "test*.py"
class HangManEngineTest(unittest.TestCase):
def test_getStartString(self):
hangManEngine = HangManEngine.HangManEngine('NOTTESTING')
self.assertEqual(hangManEngine.getMessage(),
'This is a game of hangman. For an explanation, please search the web.' )
def test_readAndReturnCharacter(self):
hangManEngine = HangManEngine.HangManEngine('NOTTESTING')
self.assertEqual(hangManEngine.readInput('A'),'A')
def test_printInput(self):
hangManEngine = HangManEngine.HangManEngine('NOTTESTING')
self.assertEqual(hangManEngine.printInput('A'),'You chose an "A"')
def test_isInWord(self):
hangManEngine = HangManEngine.HangManEngine('NOTTESTING')
self.assertTrue(hangManEngine.isInWord('E'))
def test_isNotInWord(self):
hangManEngine = HangManEngine.HangManEngine('NOTTESTING')
self.assertFalse(hangManEngine.isInWord('A'))
def test_doIfGuessTrue(self):
hangManEngine = HangManEngine.HangManEngine('NOTTESTING')
self.assertTrue(hangManEngine.doIfGuessTrue('E'))
def test_doIfGuessFalse(self):
hangManEngine = HangManEngine.HangManEngine('NOTTESTING')
self.assertFalse(hangManEngine.doIfGuessTrue('A'))