Commits

Andrew Dalke committed eb8fe61

Added test case to ignore structures which aren't part of the match threshold

Comments (0)

Files changed (2)

                 # structure didn't make it.
                 assert args.threshold < 1, "No indices but should have matched everything!"
                 continue
-            assert atom_indices
             bond_indices = _get_match_bond_indices(pat, structure, atom_indices)
             subgraph = Subgraph(atom_indices, bond_indices)
             if atom_class_tag:

tests/test_commandline.py

     def test_that_size_rejection_does_not_affect_the_threshold_calculation(self):
         confirm("threshold.smi --min-num-atoms 7 --threshold 0.5", None, None)
         confirm("threshold.smi --min-num-atoms 7 --threshold 0.3", None, None)
+
+    def test_that_fragment_output_skips_ignored_structures(self):
+        stdout, stderr = run("threshold.smi --threshold 0.4 --output-format fragment-smiles --output-all")
+        self.assertTrue(" mol5" in stdout, stdout)
+        self.assertTrue(" mol6" in stdout, stdout)
+        self.assertTrue(" mol8" in stdout, stdout)
+        self.assertTrue(" mol9" in stdout, stdout)
+        
+        self.assertFalse(" mol1" in stdout, stdout)
+        self.assertFalse(" mol2" in stdout, stdout)
+        self.assertFalse(" mol3" in stdout, stdout)
+        self.assertFalse(" mol4" in stdout, stdout)
+        self.assertFalse(" mol7" in stdout, stdout)
+                                                           
     
     def test_threshold_too_small(self):
         stdout, stderr = run("threshold.smi --compare topology --threshold -2.0", expect_sysexit=True)