Skip to content

Commit

Permalink
turning test into smiles
Browse files Browse the repository at this point in the history
  • Loading branch information
SalvadorBrandolin committed Sep 26, 2023
1 parent 4f8c605 commit 16c6aaf
Show file tree
Hide file tree
Showing 54 changed files with 266 additions and 146 deletions.
11 changes: 5 additions & 6 deletions tests/classic_unifac_groups/test_01_ch2.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@
("C1CC1", {"CH2": 3}, "smiles"),
("C1CCC1", {"CH2": 4}, "smiles"),
("C1C2CC1CCCC2", {"CH2": 6, "CH": 2}, "smiles"),
# the space ship
("CC12C3CCC4CCC1C234", {"CH3": 1, "CH2": 4, "CH": 3, "C": 2}, "smiles"),
("CCC(CC)C(C)(C)C", {"CH3": 5, "CH2": 2, "CH": 1, "C": 1}, "smiles"),
("C1CCC2CCCCC2C1", {"CH2": 8, "CH": 2}, "smiles"),
("C1CCC(CC1)CC2CCCCC2", {"CH2": 11, "CH": 2}, "smiles"),
("ethane", {"CH3": 2}, "name"),
("hexane", {"CH3": 2, "CH2": 4}, "name"),
("2-methylpropane", {"CH3": 3, "CH": 1}, "name"),
("2,2-dimethylpropane", {"CH3": 4, "C": 1}, "name"),
("cyclohexane", {"CH2": 6}, "name"),
("CC", {"CH3": 2}, "smiles"), # ethane
("CCCCCC", {"CH3": 2, "CH2": 4}, "smiles"), # hexane
("CC(C)C", {"CH3": 3, "CH": 1}, "smiles"), # 2-methylpropane
("CC(C)(C)C", {"CH3": 4, "C": 1}, "smiles"), # 2,2-dimethylpropane
("C1CCCCC1", {"CH2": 6}, "smiles"), # cyclohexane
]


Expand Down
14 changes: 7 additions & 7 deletions tests/classic_unifac_groups/test_02_ceqc.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,13 @@
{"CH3": 1, "CH2": 9, "CH": 3, "CH=CH": 2},
"smiles",
),
# cyclohexene
("C1CCC=CC1", {"CH2": 4, "CH=CH": 1}, "smiles"),
("2,3-dimethylbutene-2", {"C=C": 1, "CH3": 4}, "name"),
("2-methyl-2-butene", {"CH=C": 1, "CH3": 3}, "name"),
("2-methyl-1-butene", {"CH2": 1, "CH2=C": 1, "CH3": 2}, "name"),
("2-hexene", {"CH2": 2, "CH=CH": 1, "CH3": 2}, "name"),
("1-hexene", {"CH2": 3, "CH2=CH": 1, "CH3": 1}, "name"),
("C1CCC=CC1", {"CH2": 4, "CH=CH": 1}, "smiles"), # cyclohexene
("CC(=C(C)C)C", {"C=C": 1, "CH3": 4}, "smiles"), # 2,3-dimethylbutene-2
("CC=C(C)C", {"CH=C": 1, "CH3": 3}, "smiles"), # 2-methyl-2-butene
# 2-methyl-1-butene
("CCC(=C)C", {"CH2": 1, "CH2=C": 1, "CH3": 2}, "smiles"),
("CCCC=CC", {"CH2": 2, "CH=CH": 1, "CH3": 2}, "smiles"), # 2-hexene
("CCCCC=C", {"CH2": 3, "CH2=CH": 1, "CH3": 1}, "smiles"), # 1-hexene
# impossibles
("C=C=C", {}, "smiles"),
("CC=CC(C)C(C)=C=C", {}, "smiles"),
Expand Down
7 changes: 3 additions & 4 deletions tests/classic_unifac_groups/test_03_ach.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@
),
# biphenyl
("C1=CC=C(C=C1)C2=CC=CC=C2", {"ACH": 10, "AC": 2}, "smiles"),
# Naphthalene
("C1=CC=C2C=CC=CC2=C1", {"ACH": 8, "AC": 2}, "smiles"),
("benzene", {"ACH": 6}, "name"),
("styrene", {"AC": 1, "CH2=CH": 1, "ACH": 5}, "name"),
("C1=CC=C2C=CC=CC2=C1", {"ACH": 8, "AC": 2}, "smiles"), # Naphthalene
("C1=CC=CC=C1", {"ACH": 6}, "smiles"), # benzene
("C=CC1=CC=CC=C1", {"AC": 1, "CH2=CH": 1, "ACH": 5}, "smiles"), # styrene
]


Expand Down
12 changes: 8 additions & 4 deletions tests/classic_unifac_groups/test_04_acch2.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,14 @@
{"ACH": 4, "ACCH": 1, "ACCH2": 1, "CH3": 3},
"smiles",
),
("Gastrodigenin", {"ACH": 4, "ACOH": 1, "ACCH2": 1, "OH": 1}, "name"),
("cumene", {"CH3": 2, "ACH": 5, "ACCH": 1}, "name"),
("ethylbenzene", {"CH3": 1, "ACH": 5, "ACCH2": 1}, "name"),
("toluene", {"ACH": 5, "ACCH3": 1}, "name"),
# Gastrodigenin
("C1=CC(=CC=C1CO)O", {"ACH": 4, "ACOH": 1, "ACCH2": 1, "OH": 1}, "smiles"),
# cumene
("CC(C)C1=CC=CC=C1", {"CH3": 2, "ACH": 5, "ACCH": 1}, "smiles"),
# ethylbenzene
("CCC1=CC=CC=C1", {"CH3": 1, "ACH": 5, "ACCH2": 1}, "smiles"),
# toluene
("CC1=CC=CC=C1", {"ACH": 5, "ACCH3": 1}, "smiles"),
]


Expand Down
3 changes: 2 additions & 1 deletion tests/classic_unifac_groups/test_05_oh.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
),
# (2S,3S)-2-Methyl-1,3-hexanediol
("CCCC(C(C)CO)O", {"CH3": 2, "CH2": 3, "CH": 2, "OH": 2}, "smiles"),
("2-propanol", {"CH3": 2, "CH": 1, "OH": 1}, "name"),
# 2-propanol
("CC(C)O", {"CH3": 2, "CH": 1, "OH": 1}, "smiles"),
]


Expand Down
3 changes: 2 additions & 1 deletion tests/classic_unifac_groups/test_06_ch3oh.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
# =============================================================================

# UNIFAC
trials_unifac = [("methanol", {"CH3OH": 1}, "name")]
# methanol
trials_unifac = [("CO", {"CH3OH": 1}, "smiles")]


@pytest.mark.CH3OH
Expand Down
8 changes: 4 additions & 4 deletions tests/classic_unifac_groups/test_07_h2o.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
# =============================================================================

# UNIFAC
trials_unifac = [("water", {"H2O": 1})]
trials_unifac = [("O", {"H2O": 1}, "smiles")]


@pytest.mark.H2O
@pytest.mark.UNIFAC
@pytest.mark.parametrize("name, result", trials_unifac)
def test_h2o_unifac(name, result):
groups = ug.Groups(name)
@pytest.mark.parametrize("identifier, result, identifier_type", trials_unifac)
def test_h2o_unifac(identifier, result, identifier_type):
groups = ug.Groups(identifier, identifier_type)
assert groups.unifac_groups == result
assert groups.psrk_groups == result
2 changes: 1 addition & 1 deletion tests/classic_unifac_groups/test_08_acoh.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
{"ACH": 7, "AC": 2, "ACOH": 3},
"smiles",
),
("phenol", {"ACH": 5, "ACOH": 1}, "name"),
("C1=CC=C(C=C1)O", {"ACH": 5, "ACOH": 1}, "smiles"),
]


Expand Down
9 changes: 6 additions & 3 deletions tests/classic_unifac_groups/test_09_ch2co.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,12 @@
),
# acetophenone
("CC(=O)C1=CC=CC=C1", {"ACH": 5, "AC": 1, "CH3CO": 1}, "smiles"),
("acetone", {"CH3CO": 1, "CH3": 1}, "name"),
("3-pentanone", {"CH3": 2, "CH2": 1, "CH2CO": 1}, "name"),
("2-butanone", {"CH3": 1, "CH2": 1, "CH3CO": 1}, "name"),
# acetone
("CC(=O)C", {"CH3CO": 1, "CH3": 1}, "smiles"),
# 3-pentanones
("CCC(=O)CC", {"CH3": 2, "CH2": 1, "CH2CO": 1}, "smiles"),
# 2-butanone
("CCC(=O)C", {"CH3": 1, "CH2": 1, "CH3CO": 1}, "smiles"),
]


Expand Down
8 changes: 5 additions & 3 deletions tests/classic_unifac_groups/test_10_cho.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,13 @@
("CCCCC=O", {"CH3": 1, "CH2": 3, "CHO": 1}, "smiles"),
# 3-methylbutanal
("CC(C)CC=O", {"CH3": 2, "CH2": 1, "CH": 1, "CHO": 1}, "smiles"),
("acetaldehyde", {"CH3": 1, "CHO": 1}, "name"),
# acetaldehyde
("CC=O", {"CH3": 1, "CHO": 1}, "smiles"),
# 2-Hexyl-3-Phenyl-2-Propenal
(
"2-Hexyl-3-Phenyl-2-Propenal",
r"CCCCCC\C(C=O)=C/C1=CC=CC=C1",
{"ACH": 5, "AC": 1, "CH=C": 1, "CH2": 5, "CH3": 1, "CHO": 1},
"name",
"smiles",
),
]

Expand Down
6 changes: 4 additions & 2 deletions tests/classic_unifac_groups/test_11_ccoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,10 @@
("CC(=O)OC(C)(C)C", {"CH3COO": 1, "CH3": 3, "C": 1}, "smiles"),
# triacetin
("CC(=O)OCC(COC(=O)C)OC(=O)C", {"CH3COO": 3, "CH2": 2, "CH": 1}, "smiles"),
("butyl propanoate", {"CH3": 2, "CH2": 3, "CH2COO": 1}, "name"),
("butyl acetate", {"CH3": 1, "CH2": 3, "CH3COO": 1}, "name"),
# butyl propanoate
("CCCCOC(=O)CC", {"CH3": 2, "CH2": 3, "CH2COO": 1}, "smiles"),
# butyl acetate
("CCCCOC(=O)C", {"CH3": 1, "CH2": 3, "CH3COO": 1}, "smiles"),
]


Expand Down
3 changes: 2 additions & 1 deletion tests/classic_unifac_groups/test_12_hcoo.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@
("C1=CC=C(C=C1)OC=O", {"ACH": 5, "AC": 1, "HCOO": 1}, "smiles"),
# methyl formate
("COC=O", {"HCOO": 1, "CH3": 1}, "smiles"),
("ethyl formate", {"HCOO": 1, "CH2": 1, "CH3": 1}, "name"),
# ethyl formate
("CCOC=O", {"HCOO": 1, "CH2": 1, "CH3": 1}, "smiles"),
]


Expand Down
22 changes: 11 additions & 11 deletions tests/classic_unifac_groups/test_13_ch2o.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,19 @@
("CCOCOCC", {"CH3": 2, "CH2O": 2, "CH2": 1}, "smiles"),
("C1COCO1", {"CH2O": 2, "CH2": 1}, "smiles"),
("C1COCCOCCOCCOCCOCCO1", {"CH2O": 6, "CH2": 6}, "smiles"),
("tetrahydrofuran", {"THF": 1}, "name"),
("diisopropyl ether", {"CH3": 4, "CH": 1, "CH-O": 1}, "name"),
("diethyl ether", {"CH3": 2, "CH2": 1, "CH2O": 1}, "name"),
("dimethyl ether", {"CH3": 1, "CH3O": 1}, "name"),
# tetrahydrofuran
("C1CCOC1", {"THF": 1}, "smiles"),
# diisopropyl ether
("CC(C)OC(C)C", {"CH3": 4, "CH": 1, "CH-O": 1}, "smiles"),
# diethyl ether
("CCOCC", {"CH3": 2, "CH2": 1, "CH2O": 1}, "smiles"),
# dimethyl ether
("COC", {"CH3": 1, "CH3O": 1}, "smiles"),
# 2H-Pyran, 2-(cyclohexyloxy)tetrahydro-
(
"SCHEMBL3938062",
{"CH2": 4, "CH": 2, "OH": 1, "COO": 1, "CH3O": 1},
"name",
),
(
"2H-Pyran, 2-(cyclohexyloxy)tetrahydro-",
"C1CCC(CC1)OC2CCCCO2",
{"CH2": 8, "CH": 1, "CH2O": 1, "CH-O": 1},
"name",
"smiles",
),
# Problematic ones
# Benzyl 2-hydroxyethyl carbonate
Expand Down
9 changes: 6 additions & 3 deletions tests/classic_unifac_groups/test_14_ch3nh2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@

# UNIFAC
trials_unifac = [
("methylamine", {"CH3NH2": 1}, "name"),
("isopropylamine", {"CH3": 2, "CHNH2": 1}, "name"),
("propylamine", {"CH3": 1, "CH2": 1, "CH2NH2": 1}, "name"),
# methylamine
("CN", {"CH3NH2": 1}, "smiles"),
# isopropylamine
("CC(C)N", {"CH3": 2, "CHNH2": 1}, "smiles"),
# propylamine
("CCCN", {"CH3": 1, "CH2": 1, "CH2NH2": 1}, "smiles"),
]


Expand Down
9 changes: 6 additions & 3 deletions tests/classic_unifac_groups/test_15_cnh.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,12 @@
{"CH3N": 2, "CH2": 7, "CH": 2, "CH2CO": 1},
"smiles",
),
("dimethylamine", {"CH3": 1, "CH3NH": 1}, "name"),
("diethylamine", {"CH3": 2, "CH2": 1, "CH2NH": 1}, "name"),
("diisopropylamine", {"CH3": 4, "CH": 1, "CHNH": 1}, "name"),
# dimethylamine
("CNC", {"CH3": 1, "CH3NH": 1}, "smiles"),
# diethylamine
("CCNCC", {"CH3": 2, "CH2": 1, "CH2NH": 1}, "smiles"),
# diisopropylamine
("CC(C)NC(C)C", {"CH3": 4, "CH": 1, "CHNH": 1}, "smiles"),
# Problematics
("CC(C)NCN", {"CHNH": 1, "CH3": 2, "CH2NH2": 1}, "smiles"),
# concatenate amine
Expand Down
6 changes: 4 additions & 2 deletions tests/classic_unifac_groups/test_16_c3n.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@
),
("CCN(C(C)C)C(C)C", {"CH2N": 1, "CH3": 5, "CH": 2}, "smiles"),
("CCN(C)CC", {"CH3N": 1, "CH2": 2, "CH3": 2}, "smiles"),
("trimethylamine", {"CH3": 2, "CH3N": 1}, "name"),
("triethylamine", {"CH3": 3, "CH2": 2, "CH2N": 1}, "name"),
# trimethylamine
("CN(C)C", {"CH3": 2, "CH3N": 1}, "smiles"),
# triethylamine
("CCN(CC)CC", {"CH3": 3, "CH2": 2, "CH2N": 1}, "smiles"),
]


Expand Down
3 changes: 2 additions & 1 deletion tests/classic_unifac_groups/test_17_acnh2.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

# UNIFAC
trials_unifac = [
("aniline", {"ACH": 5, "ACNH2": 1}, "name"),
# aniline
("C1=CC=C(C=C1)N", {"ACH": 5, "ACNH2": 1}, "smiles"),
]


Expand Down
10 changes: 6 additions & 4 deletions tests/classic_unifac_groups/test_18_pyridine.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,16 +34,18 @@
("C1=CC=C(C=C1)C1=CC=NC=C1", {"C5H4N": 1, "AC": 1, "ACH": 5}, "smiles"),
("CC(=C)C1=CC=NC=C1", {"C5H4N": 1, "CH2=C": 1, "CH3": 1}, "smiles"),
("CC1=NC=CC(O)=C1", {"C5H3N": 1, "CH3": 1, "OH": 1}, "smiles"),
("pyridine", {"C5H5N": 1}, "name"),
("3-methylpyridine", {"C5H4N": 1, "CH3": 1}, "name"),
("2,3-Dimethylpyridine", {"C5H3N": 1, "CH3": 2}, "name"),
# pyridine
("C1=CC=NC=C1", {"C5H5N": 1}, "smiles"),
# 3-methylpyridine
("CC1=CN=CC=C1", {"C5H4N": 1, "CH3": 1}, "smiles"),
# 2,3-Dimethylpyridine
("CC1=C(N=CC=C1)C", {"C5H3N": 1, "CH3": 2}, "smiles"),
]


@pytest.mark.pyridine
@pytest.mark.UNIFAC
@pytest.mark.parametrize("identifier, result, identifier_type", trials_unifac)
# @pytest.mark.skip
def test_ch3nh2_unifac(identifier, result, identifier_type):
groups = ug.Groups(identifier, identifier_type)
assert groups.unifac_groups == result
Expand Down
6 changes: 4 additions & 2 deletions tests/classic_unifac_groups/test_19_ccn.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

# UNIFAC
trials_unifac = [
("acetonitrile", {"CH3CN": 1}, "name"),
("propionitrile", {"CH3": 1, "CH2CN": 1}, "name"),
# acetonitrile
("CC#N", {"CH3CN": 1}, "smiles"),
# propionitrile
("CCC#N", {"CH3": 1, "CH2CN": 1}, "smiles"),
]


Expand Down
6 changes: 4 additions & 2 deletions tests/classic_unifac_groups/test_20_cooh.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@
{"COOH": 1, "CHNH2": 1, "CH2": 1, "CH2NH2": 1},
"smiles",
),
("acetic acid", {"CH3": 1, "COOH": 1}, "name"),
("formic acid", {"HCOOH": 1}, "name"),
# acetic acid
("CC(=O)O", {"CH3": 1, "COOH": 1}, "smiles"),
# formic acid
("C(=O)O", {"HCOOH": 1}, "smiles"),
]


Expand Down
9 changes: 6 additions & 3 deletions tests/classic_unifac_groups/test_21_ccl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@

# UNIFAC
trials_unifac = [
("1-chlorobutane", {"CH3": 1, "CH2": 2, "CH2CL": 1}, "name"),
("2-chloropropane", {"CH3": 2, "CHCL": 1}, "name"),
("2-chloro-2-methylpropane", {"CH3": 3, "CCL": 1}, "name"),
# 1-chlorobutane
("CCCCCl", {"CH3": 1, "CH2": 2, "CH2CL": 1}, "smiles"),
# 2-chloropropane
("CC(C)Cl", {"CH3": 2, "CHCL": 1}, "smiles"),
# 2-chloro-2-methylpropane
("CC(C)(C)Cl", {"CH3": 3, "CCL": 1}, "smiles"),
]


Expand Down
9 changes: 6 additions & 3 deletions tests/classic_unifac_groups/test_22_ccl2.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
# UNIFAC
trials_unifac = [
("OC(Cl)Cl", {"CHCL2": 1, "OH": 1}, "smiles"),
("dichloro methane", {"CH2CL2": 1}, "name"),
("1,1-dichloroethane", {"CH3": 1, "CHCL2": 1}, "name"),
("2,2-dichloropropane", {"CH3": 2, "CCL2": 1}, "name"),
# dichloro methane
("C(Cl)Cl", {"CH2CL2": 1}, "smiles"),
# 1,1-dichloroethane
("CC(Cl)Cl", {"CH3": 1, "CHCL2": 1}, "smiles"),
# 2,2-dichloropropane
("CC(C)(Cl)Cl", {"CH3": 2, "CCL2": 1}, "smiles"),
]


Expand Down
6 changes: 4 additions & 2 deletions tests/classic_unifac_groups/test_23_ccl3.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@

# UNIFAC
trials_unifac = [
("chloroform", {"CHCL3": 1}, "name"),
("trichloroethane", {"CH3": 1, "CCL3": 1}, "name"),
# chloroform
("C(Cl)(Cl)Cl", {"CHCL3": 1}, "smiles"),
# trichloroethane
("CC(Cl)(Cl)Cl", {"CH3": 1, "CCL3": 1}, "smiles"),
]


Expand Down
3 changes: 2 additions & 1 deletion tests/classic_unifac_groups/test_24_ccl4.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

# UNIFAC
trials_unifac = [
("tetrachloromethane", {"CCL4": 1}, "name"),
# tetrachloromethane
("C(Cl)(Cl)(Cl)Cl", {"CCL4": 1}, "smiles"),
]


Expand Down
3 changes: 2 additions & 1 deletion tests/classic_unifac_groups/test_25_accl.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@

# UNIFAC
trials_unifac = [
("chlorobenzene ", {"ACCL": 1, "ACH": 5}, "name"),
# chlorobenzene
("C1=CC=C(C=C1)Cl", {"ACCL": 1, "ACH": 5}, "smiles"),
]


Expand Down
9 changes: 6 additions & 3 deletions tests/classic_unifac_groups/test_26_cno2.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
"smiles",
),
("[O-][N+](=O)CC1=CC=CC=C1", {"ACH": 5, "AC": 1, "CH2NO2": 1}, "smiles"),
("nitromethane", {"CH3NO2": 1}, "name"),
("1-nitropropane", {"CH3": 1, "CH2": 1, "CH2NO2": 1}, "name"),
("2-nitropropane", {"CH3": 2, "CHNO2": 1}, "name"),
# nitromethane
("C[N+](=O)[O-]", {"CH3NO2": 1}, "smiles"),
# 1-nitropropane
("CCC[N+](=O)[O-]", {"CH3": 1, "CH2": 1, "CH2NO2": 1}, "smiles"),
# 2-nitropropane
("CC(C)[N+](=O)[O-]", {"CH3": 2, "CHNO2": 1}, "smiles"),
]


Expand Down
Loading

0 comments on commit 16c6aaf

Please sign in to comment.