Skip to content

Commit 21ac29a

Browse files
committed
Fix integration tests (biojava#128), which I broke in 3c7315e
- We now allow '_' as a synonym for chain 'A' (needed in old files), so the test specifically disallowing this was failing. - I changed it to check for an actual missing chain - BerkeleyScop has slightly different comments than MRC scop, and the test cases are inflexible.
1 parent e35118c commit 21ac29a

2 files changed

Lines changed: 15 additions & 4 deletions

File tree

integrationtest/src/test/java/org/biojava/structure/test/StructureToolsTest.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,17 +172,27 @@ public void testGetSubRanges() throws StructureException {
172172
range = "-";
173173
substr = StructureTools.getSubRanges(structure2, range);
174174
assertEquals("Should have gotten whole structure",structure2, substr);
175-
175+
176176
// Test single-chain syntax
177177
range = "_:";
178178
substr = StructureTools.getSubRanges(structure, range);
179179
assertEquals("Wrong number of chains in "+range, 1, substr.size());
180-
180+
181181
chain = substr.getChain(0);
182182
assertEquals("Did not find the expected number of residues in first chain of "+range, 123, chain.getAtomLength() );
183+
184+
// Test single-chain syntax in a multi-chain structure. Should give chain A.
185+
range = "_:";
186+
substr = StructureTools.getSubRanges(structure2, range);
187+
assertEquals("Wrong number of chains in "+range, 1, substr.size());
188+
189+
chain = substr.getChain(0);
190+
assertEquals("Chain _ not converted to chain A.","A",chain.getChainID());
191+
assertEquals("Did not find the expected number of residues in first chain of "+range, 411, chain.getAtomLength() );
183192

184193
try {
185-
range = "_:";
194+
// Illegal chain name
195+
range = "X:";
186196
substr = StructureTools.getSubRanges(structure2, range);
187197
fail("Illegal chain name in '"+range+"'. Should throw StructureException");
188198
} catch(StructureException ex) {} //expected

integrationtest/src/test/java/org/biojava/structure/test/scop/ScopDatabaseTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,8 @@ public void testComments() {
208208
assertEquals(tag+"Wrong number of comments", 1, comments.size());
209209
assertEquals(tag+"Wrong comment", "complexed with cmo, hem", comments.get(0).trim());
210210
}
211-
if(scop.getScopVersion().compareToIgnoreCase( ScopFactory.VERSION_1_75) >= 0 ) {
211+
if(scop.getScopVersion().compareToIgnoreCase( ScopFactory.VERSION_1_73) >= 0 &&
212+
scop.getScopVersion().compareToIgnoreCase( ScopFactory.VERSION_1_75) <= 0) {
212213
// Note: only tested so far with 1.75, so may need some modification for earlier versions
213214

214215
comments = scop.getComments(127355);

0 commit comments

Comments
 (0)