Skip to content

Commit 47b58d5

Browse files
committed
Tests: create NO2 to ONO perception test an individual tst
and a minor efficiency improvement
1 parent a7d2c7e commit 47b58d5

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

arc/species/converter_test.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3370,6 +3370,7 @@ def test_molecules_from_xyz(self):
33703370
self.assertEqual(b_mol.multiplicity, 1)
33713371
self.assertFalse(any(atom.radical_electrons for atom in b_mol.atoms))
33723372

3373+
def test_ono_xyz(self):
33733374
c2h5no2_xyz = """O 0.62193295 1.59121319 -0.58381518
33743375
N 0.43574593 0.41740669 0.07732982
33753376
O 1.34135576 -0.35713755 0.18815532
@@ -3388,9 +3389,12 @@ def test_molecules_from_xyz(self):
33883389
)
33893390
self.assertEqual(s_mol.get_net_charge(), 0)
33903391
self.assertEqual(b_mol.get_net_charge(), 0)
3391-
self.assertIn('[N+]', b_mol.to_smiles())
3392-
self.assertIn('[O-]', b_mol.to_smiles())
3393-
self.assertIn('=O', b_mol.to_smiles())
3392+
smiles = b_mol.copy(deep=True).to_smiles()
3393+
self.assertIn('[N+]', smiles)
3394+
self.assertIn('[O-]', smiles)
3395+
self.assertIn('=O', smiles)
3396+
self.assertEqual([atom.element.symbol for atom in s_mol.atoms], ['O', 'N', 'O', 'C', 'C', 'H', 'H', 'H', 'H', 'H'])
3397+
self.assertEqual([atom.element.symbol for atom in b_mol.atoms], ['O', 'N', 'O', 'C', 'C', 'H', 'H', 'H', 'H', 'H'])
33943398

33953399
def test_unsorted_xyz_mol_from_xyz(self):
33963400
"""Test atom order conservation when xyz isn't sorted with heavy atoms first"""
@@ -3631,6 +3635,7 @@ def test_xyz_to_smiles(self):
36313635
self.assertEqual(mol16.to_smiles(), '[O]N=C')
36323636
self.assertEqual(mol17.to_smiles(), '[O-][S+](=O)(O)O')
36333637
self.assertEqual(mol18.to_smiles(), 'O=S(=O)=O')
3638+
self.assertEqual([atom.element.symbol for atom in mol19.atoms], ['N', 'N', 'C', 'C', 'C', 'H', 'H', 'H'])
36343639
self.assertEqual(mol19.to_adjacency_list(), """multiplicity 2
36353640
1 N u1 p1 c0 {4,S} {5,S}
36363641
2 N u0 p1 c0 {3,S} {5,D}

0 commit comments

Comments
 (0)