def test_max_pair_distance_pairs(): """Test that max pair distance pairs are computed properly.""" from rdkit import Chem # Carbon mol = Chem.MolFromSmiles('C') # Test distance 1 pair_edges = max_pair_distance_pairs(mol, 1) assert pair_edges.shape == (2, 1) assert np.all(pair_edges.flatten() == np.array([0, 0])) # Test distance 2 pair_edges = max_pair_distance_pairs(mol, 2) assert pair_edges.shape == (2, 1) assert np.all(pair_edges.flatten() == np.array([0, 0])) # Test alkane mol = Chem.MolFromSmiles('CCC') # Test distance 1 pair_edges = max_pair_distance_pairs(mol, 1) # 3 self connections and 2 bonds which are both counted twice because of # symmetry for 7 total assert pair_edges.shape == (2, 7) # Test distance 2 pair_edges = max_pair_distance_pairs(mol, 2) # Everything is connected at this distance assert pair_edges.shape == (2, 9)
def test_max_pair_distance_infinity(): """Test that max pair distance pairs are computed properly with infinity distance.""" from rdkit import Chem # Test alkane mol = Chem.MolFromSmiles('CCC') # Test distance infinity pair_edges = max_pair_distance_pairs(mol, None) # Everything is connected at this distance assert pair_edges.shape == (2, 9) # Test pentane mol = Chem.MolFromSmiles('CCCCC') # Test distance infinity pair_edges = max_pair_distance_pairs(mol, None) # Everything is connected at this distance assert pair_edges.shape == (2, 25)