File: UnitTestSATIS.py

package info (click to toggle)
rdkit 202009.4-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 129,624 kB
  • sloc: cpp: 288,030; python: 75,571; java: 6,999; ansic: 5,481; sql: 1,968; yacc: 1,842; lex: 1,254; makefile: 572; javascript: 461; xml: 229; fortran: 183; sh: 134; cs: 93
file content (37 lines) | stat: -rwxr-xr-x 1,321 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#
#  Copyright (C) 2001-2017  greg Landrum
#
#   @@ All Rights Reserved @@
#  This file is part of the RDKit.
#  The contents are covered by the terms of the BSD license
#  which is included in the file license.txt, found at the root
#  of the RDKit source tree.
#


import unittest

from rdkit import Chem
from rdkit.Chem import SATIS


class TestCase(unittest.TestCase):

  def test1(self):
    data = [('CC(=O)NC', ['0601010106', '0606070895', '0806999995', '0701060699', '0601010107']),
            ('O=CC(=O)C', ['0806999993', '0601060893', '0606060894', '0806999994', '0601010106']),
            ('C(=O)OCC(=O)O', ['0601080896', '0806999996', '0806069996', '0601010608', '0606080898',
                               '0806999998', '0801069998']),
            ('C(=O)[O-]', ['0601080897', '0806999997', '0806999997']),
            ('CP(F)(Cl)(Br)(O)', ['0601010115', '1508091735', '0915999999', '1715999999',
                                  '3515999999', '0801159999']),
            ('C=C', ['0601010699', '0601010699']), ]
    msg = "Bad SATIS for mol %s: %s should have been %s"
    for smi, res in data:
      m = Chem.MolFromSmiles(smi)
      satis = SATIS.SATISTypes(m)
      self.assertEqual(satis, res, msg=msg % (smi, str(satis), str(res)))


if __name__ == '__main__':  # pragma: nocover
  unittest.main()