1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 from unittest import TestCase
24
25
26 from lib.io import DummyFileObject
27 from lib.spectrum.sparky import write_list
28
29
31 """Unit tests for the lib.software.sparky relax module."""
32
34 """Test the lib.software.sparky.write_list() function."""
35
36
37 res_names = ['LEU', 'GLY', 'SER', 'MET', 'TRP', 'TRP', 'ASN']
38 res_nums = [3, 4, 5, 6, 40, 40, 55]
39 atom1_names = ['N', 'N', 'N', 'N', 'N', 'NE1', 'N']
40 atom2_names = ['HN', 'HN', 'HN', 'HN', 'HN', 'HE1', 'HN']
41 w1 = [122.454, 111.978, 115.069, 120.910, 123.335, 130.204, 116.896]
42 w2 = [8.397, 8.720, 8.177, 8.813, 8.005, 10.294, 7.468]
43 heights = [2535, 5050, 51643, 53663, -65111, -181131, -105322]
44
45
46 file_data = [
47 ' Assignment w1 w2 Data Height\n',
48 '\n',
49 ' LEU3N-HN 122.454 8.397 2535\n',
50 ' GLY4N-HN 111.978 8.720 5050\n',
51 ' SER5N-HN 115.069 8.177 51643\n',
52 ' MET6N-HN 120.910 8.813 53663\n',
53 ' TRP40N-HN 123.335 8.005 -65111\n',
54 ' TRP40NE1-HE1 130.204 10.294 -181131\n',
55 ' ASN55N-HN 116.896 7.468 -105322\n'
56 ]
57
58
59 file = DummyFileObject()
60 write_list(file_prefix=file, res_names=res_names, res_nums=res_nums, atom1_names=atom1_names, atom2_names=atom2_names, w1=w1, w2=w2, data_height=heights)
61
62
63 lines = file.readlines()
64 self.assertEqual(len(lines), len(file_data))
65 for i in range(len(lines)):
66 self.assertEqual(lines[i], file_data[i])
67