-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathhw6.py
34 lines (24 loc) · 831 Bytes
/
hw6.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
30
31
32
33
34
import re
import unittest
def sumNums(fileName):
pass
def countWord(fileName, word):
pass
def listURLs(fileName):
pass
class TestHW6(unittest.TestCase):
""" Class to test this homework """
def test_sumNums1(self):
""" test sumNums on the first file """
self.assertEqual(sumNums("regex_sum_42.txt"), 445833)
def test_sumNums2(self):
""" test sumNums on the second file """
self.assertEqual(sumNums("regex_sum_132198.txt"), 374566)
def test_countWord(self):
""" test count word on the first file """
self.assertEqual(countWord("regex_sum_42.txt", "computer"),15)
def test_listURLs(self):
""" test list URLs on the first file """
self.assertEqual(len(listURLs("regex_sum_42.txt")), 3)
# run the tests
unittest.main(verbosity=2)