Skip to content

Commit

Permalink
Added unit test for data fields to allow to start with '>' (bug #2911…
Browse files Browse the repository at this point in the history
…300).

Signed-off-by: Rajarshi  Guha <rajarshi.guha@gmail.com>
  • Loading branch information
egonw authored and rajarshi committed Dec 10, 2009
1 parent d3fe073 commit 8e4161e
Show file tree
Hide file tree
Showing 2 changed files with 68 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/test/data/mdl/bug2911300.sdf
@@ -0,0 +1,43 @@

-ISIS- 09180213452D

17 17 0 0 0 0 0 0 0 0999 V2000
1.2724 1.1345 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0345 1.8517 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
1.2724 -0.2793 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2.5172 1.8517 0.0000 C 0 0 3 0 0 0 0 0 0 0 0 0
-1.1931 1.1345 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
0.0345 -1.0035 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
2.1448 3.2517 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
3.1241 0.5483 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
3.8724 2.3448 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
-1.1931 -0.2793 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-2.4414 1.8517 0.0000 C 0 0 3 0 0 0 0 0 0 0 0 0
0.0345 -2.4379 0.0000 C 0 0 0 0 0 0 0 0 0 0 0 0
-3.7897 2.3448 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
-3.0448 0.5483 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
-2.0690 3.2517 0.0000 F 0 0 0 0 0 0 0 0 0 0 0 0
1.2724 -3.1552 0.0000 O 0 0 0 0 0 0 0 0 0 0 0 0
-1.1931 -3.1552 0.0000 Cl 0 0 0 0 0 0 0 0 0 0 0 0
1 2 2 0 0 0 0
1 3 1 0 0 0 0
1 4 1 0 0 0 0
2 5 1 0 0 0 0
3 6 2 0 0 0 0
4 7 1 0 0 0 0
4 8 1 0 0 0 0
4 9 1 0 0 0 0
5 10 2 0 0 0 0
5 11 1 0 0 0 0
6 12 1 0 0 0 0
11 13 1 0 0 0 0
11 14 1 0 0 0 0
11 15 1 0 0 0 0
12 16 2 0 0 0 0
12 17 1 0 0 0 0
6 10 1 0 0 0 0
M END
> <IC50_uM>
>1

$$$$
25 changes: 25 additions & 0 deletions src/test/org/openscience/cdk/io/SDFReaderTest.java
Expand Up @@ -35,7 +35,9 @@
import org.openscience.cdk.ChemFile;
import org.openscience.cdk.ChemModel;
import org.openscience.cdk.Molecule;
import org.openscience.cdk.interfaces.IChemFile;
import org.openscience.cdk.interfaces.IChemModel;
import org.openscience.cdk.interfaces.IChemSequence;
import org.openscience.cdk.interfaces.IMolecule;
import org.openscience.cdk.interfaces.IMoleculeSet;

Expand Down Expand Up @@ -164,4 +166,27 @@ public class SDFReaderTest extends SimpleChemObjectReaderTest {
Assert.assertEquals("ola11", m.getProperty("STRUCTURE ID"));
}

/**
* Tests that data fields starting with a '>' are allowed.
*
* @cdk.bug 2911300
*/
@Test public void testBug2911300() throws Exception {
String filename = "data/mdl/bug2911300.sdf";
InputStream ins = this.getClass().getClassLoader().
getResourceAsStream(filename);
MDLV2000Reader reader = new MDLV2000Reader(ins);
IChemFile fileContents = (IChemFile)reader.read(new ChemFile());
Assert.assertEquals(1, fileContents.getChemSequenceCount());
IChemSequence sequence = fileContents.getChemSequence(0);
IChemModel model = sequence.getChemModel(0);
Assert.assertNotNull(model);
IMoleculeSet som = model.getMoleculeSet();
Assert.assertNotNull(som);
Assert.assertEquals(1, som.getMoleculeCount());
IMolecule m = som.getMolecule(0);
Assert.assertNotNull(m);
Assert.assertEquals(">1", m.getProperty("IC50_uM"));
}

}

0 comments on commit 8e4161e

Please sign in to comment.