-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting.py
37 lines (25 loc) · 1 KB
/
testing.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
35
36
37
""" Testing Module """
import unittest as UT
from os import remove
from slcsp import *
import dataset
def setUpModule():
""" Create dummy files (similar to a test database). """
dataset.create_test_dataset()
def tearDownModule():
""" Delete dummy files. """
for file_name in dataset.test_files:
remove(file_name)
class MainFunctionTests(UT.TestCase):
""" This is not good testing; it does not even qualify as unit testing. """
def test_all_functions(self):
unittest_files = tuple(dataset.test_files)
if has_all_files(unittest_files):
slcsp_csv, zips_csv, plans_csv = unittest_files
replace_empty_slcsp_file_with_full(slcsp_csv, zips_csv, plans_csv)
with open(slcsp_csv) as results_file:
unittest_results = results_file.readlines()
self.assertEqual(unittest_results, dataset.results)
################################################################################
if __name__ == '__main__':
UT.main()