pdb-tools 2.4.12__py3-none-any.whl → 2.5.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (58) hide show
  1. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/METADATA +19 -11
  2. pdb_tools-2.5.1.dist-info/RECORD +55 -0
  3. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/WHEEL +1 -1
  4. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/entry_points.txt +1 -1
  5. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info}/top_level.txt +0 -1
  6. pdbtools/pdb_selmodel.py +194 -0
  7. pdbtools/pdb_tidy.py +17 -9
  8. pdb_tools-2.4.12.dist-info/RECORD +0 -103
  9. tests/__init__.py +0 -38
  10. tests/config.py +0 -25
  11. tests/test_pdb_b.py +0 -161
  12. tests/test_pdb_chain.py +0 -160
  13. tests/test_pdb_chainbows.py +0 -140
  14. tests/test_pdb_chainxseg.py +0 -156
  15. tests/test_pdb_chkensemble.py +0 -191
  16. tests/test_pdb_delchain.py +0 -165
  17. tests/test_pdb_delelem.py +0 -165
  18. tests/test_pdb_delhetatm.py +0 -115
  19. tests/test_pdb_delinsertion.py +0 -226
  20. tests/test_pdb_delres.py +0 -241
  21. tests/test_pdb_delresname.py +0 -171
  22. tests/test_pdb_element.py +0 -151
  23. tests/test_pdb_fixinsert.py +0 -223
  24. tests/test_pdb_fromcif.py +0 -124
  25. tests/test_pdb_gap.py +0 -125
  26. tests/test_pdb_head.py +0 -142
  27. tests/test_pdb_intersect.py +0 -139
  28. tests/test_pdb_keepcoord.py +0 -115
  29. tests/test_pdb_merge.py +0 -106
  30. tests/test_pdb_mkensemble.py +0 -132
  31. tests/test_pdb_occ.py +0 -161
  32. tests/test_pdb_reatom.py +0 -243
  33. tests/test_pdb_reres.py +0 -281
  34. tests/test_pdb_rplchain.py +0 -172
  35. tests/test_pdb_rplresname.py +0 -172
  36. tests/test_pdb_seg.py +0 -160
  37. tests/test_pdb_segxchain.py +0 -146
  38. tests/test_pdb_selaltloc.py +0 -943
  39. tests/test_pdb_selatom.py +0 -165
  40. tests/test_pdb_selchain.py +0 -210
  41. tests/test_pdb_selelem.py +0 -165
  42. tests/test_pdb_selhetatm.py +0 -116
  43. tests/test_pdb_selres.py +0 -257
  44. tests/test_pdb_selresname.py +0 -171
  45. tests/test_pdb_selseg.py +0 -165
  46. tests/test_pdb_shiftres.py +0 -241
  47. tests/test_pdb_sort.py +0 -254
  48. tests/test_pdb_splitchain.py +0 -242
  49. tests/test_pdb_splitmodel.py +0 -235
  50. tests/test_pdb_splitseg.py +0 -251
  51. tests/test_pdb_tidy.py +0 -312
  52. tests/test_pdb_tocif.py +0 -238
  53. tests/test_pdb_tofasta.py +0 -158
  54. tests/test_pdb_uniqname.py +0 -156
  55. tests/test_pdb_validate.py +0 -142
  56. tests/test_pdb_wc.py +0 -161
  57. tests/utils.py +0 -56
  58. {pdb_tools-2.4.12.dist-info → pdb_tools-2.5.1.dist-info/licenses}/LICENSE +0 -0
tests/test_pdb_b.py DELETED
@@ -1,161 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # Copyright 2018 João Pedro Rodrigues
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- """
19
- Unit Tests for `pdb_b`.
20
- """
21
-
22
- import os
23
- import sys
24
- import unittest
25
-
26
- from config import data_dir
27
- from utils import OutputCapture
28
-
29
-
30
- class TestTool(unittest.TestCase):
31
- """
32
- Generic class for testing tools.
33
- """
34
-
35
- def setUp(self):
36
- # Dynamically import the module
37
- name = 'pdbtools.pdb_b'
38
- self.module = __import__(name, fromlist=[''])
39
-
40
- def exec_module(self):
41
- """
42
- Execs module.
43
- """
44
-
45
- with OutputCapture() as output:
46
- try:
47
- self.module.main()
48
- except SystemExit as e:
49
- self.retcode = e.code
50
-
51
- self.stdout = output.stdout
52
- self.stderr = output.stderr
53
-
54
- return
55
-
56
- def test_default(self):
57
- """$ pdb_b data/dummy.pdb"""
58
-
59
- # Simulate input
60
- # pdb_b -20 dummy.pdb
61
- sys.argv = ['', os.path.join(data_dir, 'dummy.pdb')]
62
-
63
- # Execute the script
64
- self.exec_module()
65
-
66
- # Validate results
67
- self.assertEqual(self.retcode, 0) # ensure the program exited OK.
68
- self.assertEqual(len(self.stdout), 204) # no lines deleted
69
- self.assertEqual(len(self.stderr), 0) # no errors
70
-
71
- records = (('ATOM', 'HETATM'))
72
- bfactors = [l[60:66] for l in self.stdout if l.startswith(records)]
73
- unique_bfac = list(set(map(float, bfactors)))
74
- self.assertEqual(unique_bfac, [10.00]) # all bfactors changed
75
-
76
- def test_two_options(self):
77
- """$ pdb_b -20 data/dummy.pdb"""
78
-
79
- sys.argv = ['', '-20.0', os.path.join(data_dir, 'dummy.pdb')]
80
-
81
- self.exec_module()
82
-
83
- self.assertEqual(self.retcode, 0)
84
- self.assertEqual(len(self.stdout), 204)
85
- self.assertEqual(len(self.stderr), 0)
86
-
87
- records = (('ATOM', 'HETATM'))
88
- bfactors = [l[60:66] for l in self.stdout if l.startswith(records)]
89
- unique_bfac = list(set(map(float, bfactors)))
90
- self.assertEqual(unique_bfac, [20.00])
91
-
92
- def test_file_not_found(self):
93
- """$ pdb_b not_existing.pdb"""
94
-
95
- afile = os.path.join(data_dir, 'not_existing.pdb')
96
- sys.argv = ['', '-10.0', afile]
97
-
98
- self.exec_module()
99
-
100
- self.assertEqual(self.retcode, 1) # exit code is 1 (error)
101
- self.assertEqual(len(self.stdout), 0) # nothing written to stdout
102
- self.assertEqual(self.stderr[0][:22],
103
- "ERROR!! File not found") # proper error message
104
-
105
- @unittest.skipIf(os.getenv('SKIP_TTY_TESTS'), 'skip on GHA - no TTY')
106
- def test_file_missing(self):
107
- """$ pdb_b -10"""
108
-
109
- sys.argv = ['', '-10.0']
110
-
111
- self.exec_module()
112
-
113
- self.assertEqual(self.retcode, 1)
114
- self.assertEqual(len(self.stdout), 0) # no output
115
- self.assertEqual(self.stderr[0],
116
- "ERROR!! No data to process!")
117
-
118
- @unittest.skipIf(os.getenv('SKIP_TTY_TESTS'), 'skip on GHA - no TTY')
119
- def test_helptext(self):
120
- """$ pdb_b"""
121
-
122
- sys.argv = ['']
123
-
124
- self.exec_module()
125
-
126
- self.assertEqual(self.retcode, 1) # ensure the program exited gracefully.
127
- self.assertEqual(len(self.stdout), 0) # no output
128
- self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
129
-
130
- def test_invalid_option(self):
131
- """$ pdb_b -A data/dummy.pdb"""
132
-
133
- sys.argv = ['', '-A', os.path.join(data_dir, 'dummy.pdb')]
134
-
135
- self.exec_module()
136
-
137
- self.assertEqual(self.retcode, 1)
138
- self.assertEqual(len(self.stdout), 0)
139
- self.assertEqual(self.stderr[0][:47],
140
- "ERROR!! You provided an invalid b-factor value:")
141
-
142
- def test_not_an_option(self):
143
- """$ pdb_b 20 data/dummy.pdb"""
144
-
145
- sys.argv = ['', '20', os.path.join(data_dir, 'dummy.pdb')]
146
-
147
- self.exec_module()
148
-
149
- self.assertEqual(self.retcode, 1)
150
- self.assertEqual(len(self.stdout), 0)
151
- self.assertEqual(self.stderr[0],
152
- "ERROR! First argument is not an option: '20'")
153
-
154
-
155
- if __name__ == '__main__':
156
- from config import test_dir
157
-
158
- mpath = os.path.abspath(os.path.join(test_dir, '..'))
159
- sys.path.insert(0, mpath) # so we load dev files before any installation
160
-
161
- unittest.main()
tests/test_pdb_chain.py DELETED
@@ -1,160 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # Copyright 2018 João Pedro Rodrigues
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- """
19
- Unit Tests for `pdb_chain`.
20
- """
21
-
22
- import os
23
- import sys
24
- import unittest
25
-
26
- from config import data_dir
27
- from utils import OutputCapture
28
-
29
-
30
- class TestTool(unittest.TestCase):
31
- """
32
- Generic class for testing tools.
33
- """
34
-
35
- def setUp(self):
36
- # Dynamically import the module
37
- name = 'pdbtools.pdb_chain'
38
- self.module = __import__(name, fromlist=[''])
39
-
40
- def exec_module(self):
41
- """
42
- Execs module.
43
- """
44
-
45
- with OutputCapture() as output:
46
- try:
47
- self.module.main()
48
- except SystemExit as e:
49
- self.retcode = e.code
50
-
51
- self.stdout = output.stdout
52
- self.stderr = output.stderr
53
-
54
- return
55
-
56
- def test_default(self):
57
- """$ pdb_chain data/dummy.pdb"""
58
-
59
- # Simulate input
60
- sys.argv = ['', os.path.join(data_dir, 'dummy.pdb')]
61
-
62
- # Execute the script
63
- self.exec_module()
64
-
65
- # Validate results
66
- self.assertEqual(self.retcode, 0) # ensure the program exited OK.
67
- self.assertEqual(len(self.stdout), 204) # no lines deleted
68
- self.assertEqual(len(self.stderr), 0) # no errors
69
-
70
- records = (('ATOM', 'HETATM'))
71
- chain_ids = [l[21] for l in self.stdout if l.startswith(records)]
72
- unique_chain_ids = list(set(chain_ids))
73
- self.assertEqual(unique_chain_ids, [' '])
74
-
75
- def test_two_options(self):
76
- """$ pdb_chain -X data/dummy.pdb"""
77
-
78
- sys.argv = ['', '-X', os.path.join(data_dir, 'dummy.pdb')]
79
-
80
- self.exec_module()
81
-
82
- self.assertEqual(self.retcode, 0)
83
- self.assertEqual(len(self.stdout), 204)
84
- self.assertEqual(len(self.stderr), 0)
85
-
86
- records = (('ATOM', 'HETATM'))
87
- chain_ids = [l[21] for l in self.stdout if l.startswith(records)]
88
- unique_chain_ids = list(set(chain_ids))
89
- self.assertEqual(unique_chain_ids, ['X'])
90
-
91
- def test_file_not_found(self):
92
- """$ pdb_chain -A not_existing.pdb"""
93
-
94
- afile = os.path.join(data_dir, 'not_existing.pdb')
95
- sys.argv = ['', '-A', afile]
96
-
97
- self.exec_module()
98
-
99
- self.assertEqual(self.retcode, 1) # exit code is 1 (error)
100
- self.assertEqual(len(self.stdout), 0) # nothing written to stdout
101
- self.assertEqual(self.stderr[0][:22],
102
- "ERROR!! File not found") # proper error message
103
-
104
- @unittest.skipIf(os.getenv('SKIP_TTY_TESTS'), 'skip on GHA - no TTY')
105
- def test_file_missing(self):
106
- """$ pdb_chain -A"""
107
-
108
- sys.argv = ['', '-A']
109
-
110
- self.exec_module()
111
-
112
- self.assertEqual(self.retcode, 1)
113
- self.assertEqual(len(self.stdout), 0) # no output
114
- self.assertEqual(self.stderr[0],
115
- "ERROR!! No data to process!")
116
-
117
- @unittest.skipIf(os.getenv('SKIP_TTY_TESTS'), 'skip on GHA - no TTY')
118
- def test_helptext(self):
119
- """$ pdb_chain"""
120
-
121
- sys.argv = ['']
122
-
123
- self.exec_module()
124
-
125
- self.assertEqual(self.retcode, 1) # ensure the program exited gracefully.
126
- self.assertEqual(len(self.stdout), 0) # no output
127
- self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
128
-
129
- def test_invalid_option(self):
130
- """$ pdb_chain -AH data/dummy.pdb"""
131
-
132
- sys.argv = ['', '-AH', os.path.join(data_dir, 'dummy.pdb')]
133
-
134
- self.exec_module()
135
-
136
- self.assertEqual(self.retcode, 1)
137
- self.assertEqual(len(self.stdout), 0)
138
- self.assertEqual(self.stderr[0][:47],
139
- "ERROR!! Chain identifiers must be a single char")
140
-
141
- def test_not_an_option(self):
142
- """$ pdb_chain A data/dummy.pdb"""
143
-
144
- sys.argv = ['', 'A', os.path.join(data_dir, 'dummy.pdb')]
145
-
146
- self.exec_module()
147
-
148
- self.assertEqual(self.retcode, 1)
149
- self.assertEqual(len(self.stdout), 0)
150
- self.assertEqual(self.stderr[0],
151
- "ERROR! First argument is not an option: 'A'")
152
-
153
-
154
- if __name__ == '__main__':
155
- from config import test_dir
156
-
157
- mpath = os.path.abspath(os.path.join(test_dir, '..'))
158
- sys.path.insert(0, mpath) # so we load dev files before any installation
159
-
160
- unittest.main()
@@ -1,140 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # Copyright 2020 João Pedro Rodrigues
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- """
19
- Unit Tests for `pdb_chainbows`.
20
- """
21
-
22
- import os
23
- import sys
24
- import unittest
25
-
26
- from config import data_dir
27
- from utils import OutputCapture
28
-
29
-
30
- class TestTool(unittest.TestCase):
31
- """
32
- Generic class for testing tools.
33
- """
34
-
35
- def setUp(self):
36
- # Dynamically import the module
37
- name = 'pdbtools.pdb_chainbows'
38
- self.module = __import__(name, fromlist=[''])
39
-
40
- def exec_module(self):
41
- """
42
- Execs module.
43
- """
44
-
45
- with OutputCapture() as output:
46
- try:
47
- self.module.main()
48
- except SystemExit as e:
49
- self.retcode = e.code
50
-
51
- self.stdout = output.stdout
52
- self.stderr = output.stderr
53
-
54
- return
55
-
56
- def test_default(self):
57
- """$ pdb_chainbows data/dummy.pdb"""
58
-
59
- fpath = os.path.join(data_dir, 'dummy.pdb')
60
- sys.argv = ['', fpath]
61
-
62
- # Execute the script
63
- self.exec_module()
64
-
65
- # Validate results
66
- self.assertEqual(self.retcode, 0) # ensure the program exited OK.
67
- # CONECTs are ignored by issue #72, expected only 204 lines
68
- self.assertEqual(len(self.stdout), 204)
69
- self.assertEqual(len(self.stderr), 0) # no warnings/errors
70
-
71
- # Check chains were reassigned properly
72
- expected = ['A'] * 51 + ['B'] * 56 + ['C'] * 49 + ['D'] * 20
73
- chains = [
74
- l[21] for l in self.stdout if l.startswith('ATOM')
75
- ]
76
- self.assertEqual(chains, expected)
77
-
78
- # Check TERs
79
- expected = ['A', 'B', 'C']
80
- chains = [
81
- l[21] for l in self.stdout if l.startswith('TER')
82
- ]
83
- self.assertEqual(chains, expected)
84
-
85
- # Check HETATM were reassigned properly
86
- expected = ['B', 'B', 'B', 'A', 'C', 'C', 'C', 'C', 'C']
87
- chains = [
88
- l[21] for l in self.stdout if l.startswith('HETATM')
89
- ]
90
- self.assertEqual(chains, expected)
91
-
92
- def test_file_not_found(self):
93
- """$ pdb_chainbows not_existing.pdb"""
94
-
95
- # Error (file not found)
96
- afile = os.path.join(data_dir, 'not_existing.pdb')
97
- sys.argv = ['', afile]
98
-
99
- # Execute the script
100
- self.exec_module()
101
-
102
- self.assertEqual(self.retcode, 1)
103
- self.assertEqual(len(self.stdout), 0)
104
- self.assertEqual(self.stderr[0][:22],
105
- "ERROR!! File not found")
106
-
107
- @unittest.skipIf(os.getenv('SKIP_TTY_TESTS'), 'skip on GHA - no TTY')
108
- def test_helptext(self):
109
- """$ pdb_chainbows"""
110
-
111
- sys.argv = ['']
112
-
113
- # Execute the script
114
- self.exec_module()
115
-
116
- self.assertEqual(self.retcode, 1)
117
- self.assertEqual(len(self.stdout), 0)
118
- self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
119
-
120
- def test_invalid_option(self):
121
- """$ pdb_chainbows -A data/dummy.pdb"""
122
-
123
- sys.argv = ['', '-A', os.path.join(data_dir, 'dummy.pdb')]
124
-
125
- # Execute the script
126
- self.exec_module()
127
-
128
- self.assertEqual(self.retcode, 1)
129
- self.assertEqual(len(self.stdout), 0)
130
- self.assertEqual(self.stderr[0][:36],
131
- "ERROR!! Script takes 1 argument, not")
132
-
133
-
134
- if __name__ == '__main__':
135
- from config import test_dir
136
-
137
- mpath = os.path.abspath(os.path.join(test_dir, '..'))
138
- sys.path.insert(0, mpath) # so we load dev files before any installation
139
-
140
- unittest.main()
@@ -1,156 +0,0 @@
1
- #!/usr/bin/env python
2
- # -*- coding: utf-8 -*-
3
- #
4
- # Copyright 2018 João Pedro Rodrigues
5
- #
6
- # Licensed under the Apache License, Version 2.0 (the "License");
7
- # you may not use this file except in compliance with the License.
8
- # You may obtain a copy of the License at
9
- #
10
- # http://www.apache.org/licenses/LICENSE-2.0
11
- #
12
- # Unless required by applicable law or agreed to in writing, software
13
- # distributed under the License is distributed on an "AS IS" BASIS,
14
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
- # See the License for the specific language governing permissions and
16
- # limitations under the License.
17
-
18
- """
19
- Unit Tests for `pdb_chainxseg`.
20
- """
21
-
22
- import os
23
- import sys
24
- import unittest
25
-
26
- from config import data_dir
27
- from utils import OutputCapture
28
-
29
-
30
- class TestTool(unittest.TestCase):
31
- """
32
- Generic class for testing tools.
33
- """
34
-
35
- def setUp(self):
36
- # Dynamically import the module
37
- name = 'pdbtools.pdb_chainxseg'
38
- self.module = __import__(name, fromlist=[''])
39
-
40
- def exec_module(self):
41
- """
42
- Execs module.
43
- """
44
-
45
- with OutputCapture() as output:
46
- try:
47
- self.module.main()
48
- except SystemExit as e:
49
- self.retcode = e.code
50
-
51
- self.stdout = output.stdout
52
- self.stderr = output.stderr
53
-
54
- return
55
-
56
- def test_default(self):
57
- """$ pdb_chainxseg data/dummy.pdb"""
58
-
59
- # Simulate input
60
- sys.argv = ['', os.path.join(data_dir, 'dummy.pdb')]
61
-
62
- # Execute the script
63
- self.exec_module()
64
-
65
- # Validate results
66
- self.assertEqual(self.retcode, 0) # ensure the program exited OK.
67
- self.assertEqual(len(self.stdout), 204) # no lines deleted
68
- self.assertEqual(len(self.stderr), 0) # no errors
69
-
70
- records = (('ATOM', 'HETATM'))
71
- chain_ids = [l[72:76] for l in self.stdout if l.startswith(records)]
72
-
73
- # Test content
74
- unique_chain_ids = sorted(set(map(str.strip, chain_ids)))
75
- self.assertEqual(unique_chain_ids, ['A', 'B', 'C', 'D'])
76
-
77
- # Test order
78
- segid_list = ['B ', 'B ', 'B ', 'B ', 'B ', 'B ', 'B ',
79
- 'B ', 'B ', 'B ', 'B ', 'B ', 'B ', 'B ',
80
- 'B ', 'B ', 'B ', 'B ', 'B ', 'B ', 'B ',
81
- 'B ', 'B ', 'B ', 'B ', 'B ', 'B ', 'B ',
82
- 'B ', 'B ', 'B ', 'B ', 'B ', 'B ', 'B ',
83
- 'B ', 'B ', 'B ', 'B ', 'B ', 'B ', 'B ',
84
- 'B ', 'B ', 'B ', 'B ', 'B ', 'B ', 'B ',
85
- 'B ', 'B ', 'A ', 'A ', 'A ', 'A ', 'A ',
86
- 'A ', 'A ', 'A ', 'A ', 'A ', 'A ', 'A ',
87
- 'A ', 'A ', 'A ', 'A ', 'A ', 'A ', 'A ',
88
- 'A ', 'A ', 'A ', 'A ', 'A ', 'A ', 'A ',
89
- 'A ', 'A ', 'A ', 'A ', 'A ', 'A ', 'A ',
90
- 'A ', 'A ', 'A ', 'A ', 'A ', 'A ', 'A ',
91
- 'A ', 'A ', 'A ', 'A ', 'A ', 'A ', 'A ',
92
- 'A ', 'A ', 'A ', 'A ', 'A ', 'A ', 'A ',
93
- 'A ', 'A ', 'C ', 'C ', 'C ', 'C ', 'C ',
94
- 'C ', 'C ', 'C ', 'C ', 'C ', 'C ', 'C ',
95
- 'C ', 'C ', 'C ', 'C ', 'C ', 'C ', 'C ',
96
- 'C ', 'C ', 'C ', 'C ', 'C ', 'C ', 'C ',
97
- 'C ', 'C ', 'C ', 'C ', 'C ', 'C ', 'C ',
98
- 'C ', 'C ', 'C ', 'C ', 'C ', 'C ', 'C ',
99
- 'C ', 'C ', 'C ', 'C ', 'C ', 'C ', 'C ',
100
- 'C ', 'C ', 'D ', 'D ', 'D ', 'D ', 'D ',
101
- 'D ', 'D ', 'D ', 'D ', 'D ', 'D ', 'D ',
102
- 'D ', 'D ', 'D ', 'D ', 'D ', 'D ', 'D ',
103
- 'D ', 'A ', 'A ', 'A ', 'B ', 'C ', 'C ',
104
- 'C ', 'C ', 'C ']
105
-
106
- self.assertEqual(chain_ids, segid_list)
107
-
108
- def test_file_not_found(self):
109
- """$ pdb_chainxseg not_existing.pdb"""
110
-
111
- # Error (file not found)
112
- afile = os.path.join(data_dir, 'not_existing.pdb')
113
- sys.argv = ['', afile]
114
-
115
- # Execute the script
116
- self.exec_module()
117
-
118
- self.assertEqual(self.retcode, 1) # exit code is 1 (error)
119
- self.assertEqual(len(self.stdout), 0) # nothing written to stdout
120
- self.assertEqual(self.stderr[0][:22],
121
- "ERROR!! File not found") # proper error message
122
-
123
- @unittest.skipIf(os.getenv('SKIP_TTY_TESTS'), 'skip on GHA - no TTY')
124
- def test_helptext(self):
125
- """$ pdb_chainxseg"""
126
-
127
- sys.argv = ['']
128
-
129
- # Execute the script
130
- self.exec_module()
131
-
132
- self.assertEqual(self.retcode, 1) # ensure the program exited gracefully.
133
- self.assertEqual(len(self.stdout), 0) # no output
134
- self.assertEqual(self.stderr, self.module.__doc__.split("\n")[:-1])
135
-
136
- def test_invalid_option(self):
137
- """$ pdb_chainxseg -A data/dummy.pdb"""
138
-
139
- sys.argv = ['', '-A', os.path.join(data_dir, 'dummy.pdb')]
140
-
141
- # Execute the script
142
- self.exec_module()
143
-
144
- self.assertEqual(self.retcode, 1)
145
- self.assertEqual(len(self.stdout), 0)
146
- self.assertEqual(self.stderr[0][:36],
147
- "ERROR!! Script takes 1 argument, not")
148
-
149
-
150
- if __name__ == '__main__':
151
- from config import test_dir
152
-
153
- mpath = os.path.abspath(os.path.join(test_dir, '..'))
154
- sys.path.insert(0, mpath) # so we load dev files before any installation
155
-
156
- unittest.main()