# Path: chemdataextractor/text/chem.py
# SOLVENT_RE = re.compile(r'(?:^|\b)(?:(?:%s|d\d?\d?|[\dn](?:,[\dn]){0,3}|[imnoptDLRS])-?)?(?:%s)(?:-d\d?\d?)?(?=$|\b)'
#                         % ('|'.join(re.escape(s) for s in PREFIXES),
#                            '|'.join(re.escape(s).replace(r'\ ', r'[\s\-]?') for s in SOLVENTS)), re.I)
# 
# INCHI_RE = re.compile(r'^(InChI=)?1S?\/(p\+1|\d*[a-ik-z][a-ik-z\d\.]*(\/c[\d\-*(),;]+)?(\/h[\d\-*h(),;]+)?)(\/[bmpqst][\d\-\.+*,;?m]*|\/i[hdt\d\-+*,;]*(\/h[hdt\d]+)?|\/r[a-ik-z\d]+(\/c[\d\-*(),;]+)?(\/h[\d\-*h(),;]+)?|\/f[a-ik-z\d\.]*(\/h[\d\-*h(),;]+)?)*$', re.I)
# 
# SMILES_RE = re.compile(r'^([BCNOPSFIbcnosp*]|Cl|Br|\[\d*(%(e)s|se|as|\*)(@+([THALSPBO]\d+)?)?(H\d?)?([\-+]+\d*)?(:\d+)?\])'
#                        r'([BCNOPSFIbcnosp*]|Cl|Br|\[\d*(%(e)s|se|as|\*)(@+([THALSPBO]\d+)?)?(H\d?)?([\-+]+\d*)?(:\d+)?\]|'
#                        r'[\-=#$:\\/\(\)%%\.+\d])*$' % {'e': '|'.join(ELEMENT_SYMBOLS)})


import logging
import unittest
from chemdataextractor.text.chem import SOLVENT_RE, INCHI_RE, SMILES_RE
        self.assertTrue(INCHI_RE.match(u'InChI=1S/p+1/i/hT'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/C5H5N5O/c6-5-9-3-2(4(11)10-5)7-1-8-3/h1H,(H4,6,7,8,9,10,11)'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/C2H4ClNO2/c3-1(4)2(5)6/h1H,4H2,(H,5,6)/p+1/t1-/m1/s1'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/H2/h1H/i1+2T'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/CH2Cl2/c2-1-3/h1H2/i1D2'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/H2/h1H/i1+1D'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/H2O4S/c1-5(2,3)4/h(H2,1,2,3,4)/i/hD2'))

    def test_smiles(self):
        self.assertTrue(SMILES_RE.match(u'S=S'))
        self.assertTrue(SMILES_RE.match(u'P1P=P1'))
        self.assertTrue(SMILES_RE.match(u'[V].[Cu+2]'))
        self.assertTrue(SMILES_RE.match(u'O'))
        self.assertTrue(SMILES_RE.match(u'CC1=C(SC=N1)C=CC2=C(NC(SC2)C(C(=O)O)NC(=O)C(=NOC)C3=CSC(=N3)N)C(=O)O'))
        self.assertTrue(SMILES_RE.match(u'C1=CC=C(C=C1)C2=CC=C(C=C2)C3=NN=C(O3)C4=CC=CC=C4'))
        self.assertTrue(SMILES_RE.match(u'CC(=O)OO'))
        self.assertTrue(SMILES_RE.match(u'CCCCCCCC/C=C\CCCCCCCCN'))
        self.assertTrue(SMILES_RE.match(u'C[N+](C)(C)CCCCCC[N+](C)(C)C.[Br-]'))
        self.assertTrue(SMILES_RE.match(u'C([C@H](C(=O)O)N)F'))
        self.assertTrue(SMILES_RE.match(u'[Ru]'))
        self.assertTrue(SMILES_RE.match(u'[S-2].[Cu+2].[Cu+2]'))
        self.assertTrue(SMILES_RE.match(u'[Cd]=[Te]'))
        self.assertTrue(SMILES_RE.match(u'C1C[C@H](OC1)C(=O)O'))
        self.assertTrue(SMILES_RE.match(u'C(=O)(O)[O-].[OH-].[Zn+2]'))
        self.assertTrue(SMILES_RE.match(u'N#N'))
        self.assertTrue(SMILES_RE.match(u'[HH]'))
        self.assertTrue(SMILES_RE.match(u'[Li+].[Li+].[O-][Ti](=O)[O-]'))
        self.assertTrue(SMILES_RE.match(u'[F-]'))
        self.assertTrue(SMILES_RE.match(u'CC(C)[C@@H](C(=O)O)N'))
        self.assertTrue(SMILES_RE.match(u'CC(C)C(C#C)O'))

# Path: chemdataextractor/text/chem.py
# SOLVENT_RE = re.compile(r'(?:^|\b)(?:(?:%s|d\d?\d?|[\dn](?:,[\dn]){0,3}|[imnoptDLRS])-?)?(?:%s)(?:-d\d?\d?)?(?=$|\b)'
#                         % ('|'.join(re.escape(s) for s in PREFIXES),
#                            '|'.join(re.escape(s).replace(r'\ ', r'[\s\-]?') for s in SOLVENTS)), re.I)
# 
# INCHI_RE = re.compile(r'^(InChI=)?1S?\/(p\+1|\d*[a-ik-z][a-ik-z\d\.]*(\/c[\d\-*(),;]+)?(\/h[\d\-*h(),;]+)?)(\/[bmpqst][\d\-\.+*,;?m]*|\/i[hdt\d\-+*,;]*(\/h[hdt\d]+)?|\/r[a-ik-z\d]+(\/c[\d\-*(),;]+)?(\/h[\d\-*h(),;]+)?|\/f[a-ik-z\d\.]*(\/h[\d\-*h(),;]+)?)*$', re.I)
# 
# SMILES_RE = re.compile(r'^([BCNOPSFIbcnosp*]|Cl|Br|\[\d*(%(e)s|se|as|\*)(@+([THALSPBO]\d+)?)?(H\d?)?([\-+]+\d*)?(:\d+)?\])'
#                        r'([BCNOPSFIbcnosp*]|Cl|Br|\[\d*(%(e)s|se|as|\*)(@+([THALSPBO]\d+)?)?(H\d?)?([\-+]+\d*)?(:\d+)?\]|'
#                        r'[\-=#$:\\/\(\)%%\.+\d])*$' % {'e': '|'.join(ELEMENT_SYMBOLS)})


# Path: tests/test_text_chem.py
import logging
import unittest
from chemdataextractor.text.chem import SOLVENT_RE, INCHI_RE, SMILES_RE

        self.assertTrue(INCHI_RE.match(u'InChI=1S/p+1/i/hT'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/C5H5N5O/c6-5-9-3-2(4(11)10-5)7-1-8-3/h1H,(H4,6,7,8,9,10,11)'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/C2H4ClNO2/c3-1(4)2(5)6/h1H,4H2,(H,5,6)/p+1/t1-/m1/s1'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/H2/h1H/i1+2T'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/CH2Cl2/c2-1-3/h1H2/i1D2'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/H2/h1H/i1+1D'))
        self.assertTrue(INCHI_RE.match(u'InChI=1S/H2O4S/c1-5(2,3)4/h(H2,1,2,3,4)/i/hD2'))

    def test_smiles(self):
        self.assertTrue(SMILES_RE.match(u'S=S'))
        self.assertTrue(SMILES_RE.match(u'P1P=P1'))
        self.assertTrue(SMILES_RE.match(u'[V].[Cu+2]'))
        self.assertTrue(SMILES_RE.match(u'O'))
        self.assertTrue(SMILES_RE.match(u'CC1=C(SC=N1)C=CC2=C(NC(SC2)C(C(=O)O)NC(=O)C(=NOC)C3=CSC(=N3)N)C(=O)O'))
        self.assertTrue(SMILES_RE.match(u'C1=CC=C(C=C1)C2=CC=C(C=C2)C3=NN=C(O3)C4=CC=CC=C4'))
        self.assertTrue(SMILES_RE.match(u'CC(=O)OO'))
        self.assertTrue(SMILES_RE.match(u'CCCCCCCC/C=C\CCCCCCCCN'))
        self.assertTrue(SMILES_RE.match(u'C[N+](C)(C)CCCCCC[N+](C)(C)C.[Br-]'))
        self.assertTrue(SMILES_RE.match(u'C([C@H](C(=O)O)N)F'))
        self.assertTrue(SMILES_RE.match(u'[Ru]'))
        self.assertTrue(SMILES_RE.match(u'[S-2].[Cu+2].[Cu+2]'))
        self.assertTrue(SMILES_RE.match(u'[Cd]=[Te]'))
        self.assertTrue(SMILES_RE.match(u'C1C[C@H](OC1)C(=O)O'))
        self.assertTrue(SMILES_RE.match(u'C(=O)(O)[O-].[OH-].[Zn+2]'))
        self.assertTrue(SMILES_RE.match(u'N#N'))
        self.assertTrue(SMILES_RE.match(u'[HH]'))
        self.assertTrue(SMILES_RE.match(u'[Li+].[Li+].[O-][Ti](=O)[O-]'))
        self.assertTrue(SMILES_RE.match(u'[F-]'))
        self.assertTrue(SMILES_RE.match(u'CC(C)[C@@H](C(=O)O)N'))
        self.assertTrue(SMILES_RE.match(u'CC(C)C(C#C)O'))

        self.assertTrue(SMILES_RE.match(u'CCCC#N'))