-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.py
29 lines (22 loc) · 899 Bytes
/
test.py
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
import unittest
from hangman import *
class WordGameSetupTest(unittest.TestCase):
def setUp(self):
self.g = Game()
def test_easy_difficulty(self):
with open('easy_hang_words.txt', 'r') as easy_file:
easy_words = easy_file.read().split("\n")
target = self.g.word_game_setup('e')
self.assertIn(target, easy_words)
def test_normal_difficulty(self):
with open('normal_hang_words.txt', 'r') as normal_file:
normal_words = normal_file.read().split("\n")
target = self.g.word_game_setup('n')
self.assertIn(target, normal_words)
def test_hard_difficulty(self):
with open('hang_words.txt', 'r') as hard_file:
hard_words = hard_file.read().split("\n")
target = self.g.word_game_setup('h')
self.assertIn(target, hard_words)
if __name__ == '__main__':
unittest.main()