Skip to content

Commit 2ae7a9b

Browse files
committed
improve pathfinderTest with more tests
1 parent e7f0f12 commit 2ae7a9b

File tree

1 file changed

+42
-3
lines changed

1 file changed

+42
-3
lines changed

test/rmgpy/molecule/pathfinderTest.py

Lines changed: 42 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,7 +538,7 @@ class FindAdsorbateDelocalizationPathsTest:
538538
test the find_adsorbate_delocalization_paths method
539539
"""
540540

541-
def test_cch(self):
541+
def test_xcxch(self):
542542
adjlist = """
543543
1 X u0 p0 c0 {3,D}
544544
2 X u0 p0 c0 {4,S}
@@ -549,14 +549,33 @@ def test_cch(self):
549549

550550
mol = Molecule().from_adjacency_list(adjlist)
551551
paths = find_adsorbate_delocalization_paths(mol.atoms[0])
552+
no_surface_sites = sum(atom.is_surface_site() for atom in paths[0][:4])
552553
assert paths
554+
assert no_surface_sites == 2
555+
556+
def test_xcxch2(self):
557+
adjlist = """
558+
1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S}
559+
2 C u0 p0 c0 {1,S} {6,T}
560+
3 H u0 p0 c0 {1,S}
561+
4 H u0 p0 c0 {1,S}
562+
5 X u0 p0 c0 {1,S}
563+
6 X u0 p0 c0 {2,T}
564+
"""
565+
566+
mol = Molecule().from_adjacency_list(adjlist)
567+
paths = find_adsorbate_delocalization_paths(mol.atoms[0])
568+
assert len(paths) == 0
569+
570+
571+
553572

554573
class FindAdsorbateConjugateDelocalizationPathsTest:
555574
"""
556575
test the find_adsorbate_conjugate_delocalization_paths
557576
"""
558577

559-
def test_chchc(self):
578+
def test_xchchxc(self):
560579
adjlist = """
561580
1 X u0 p0 c0 {3,T}
562581
2 X u0 p0 c0 {5,S}
@@ -569,4 +588,24 @@ def test_chchc(self):
569588

570589
mol = Molecule().from_adjacency_list(adjlist)
571590
paths = find_adsorbate_conjugate_delocalization_paths(mol.atoms[0])
572-
assert paths
591+
no_surface_sites = sum(atom.is_surface_site() for atom in paths[0][:5])
592+
assert paths
593+
assert no_surface_sites == 2
594+
595+
def test_xchch2xch2(self):
596+
adjlist = """
597+
1 C u0 p0 c0 {2,S} {3,S} {4,S} {5,S}
598+
2 C u0 p0 c0 {1,S} {6,S} {7,S} {9,S}
599+
3 C u0 p0 c0 {1,S} {8,S} {10,D}
600+
4 H u0 p0 c0 {1,S}
601+
5 H u0 p0 c0 {1,S}
602+
6 H u0 p0 c0 {2,S}
603+
7 H u0 p0 c0 {2,S}
604+
8 H u0 p0 c0 {3,S}
605+
9 X u0 p0 c0 {2,S}
606+
10 X u0 p0 c0 {3,D}
607+
"""
608+
609+
mol = Molecule().from_adjacency_list(adjlist)
610+
paths = find_adsorbate_conjugate_delocalization_paths(mol.atoms[0])
611+
assert len(paths) == 0

0 commit comments

Comments
 (0)