File: test_pubchem.py

package info (click to toggle)
python-ase 3.21.1-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 13,936 kB
  • sloc: python: 122,428; xml: 946; makefile: 111; javascript: 47
file content (32 lines) | stat: -rw-r--r-- 1,187 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
def test_pubchem():
    from ase.data.pubchem import pubchem_search, pubchem_conformer_search
    from ase.data.pubchem import pubchem_atoms_search
    from ase.data.pubchem import pubchem_atoms_conformer_search

    # check class functionality
    data = pubchem_search('ammonia', mock_test=True)
    data.get_atoms()
    data.get_pubchem_data()
    # XXX maybe verify some of this data?

    # check the various entry styles and the functions that return atoms
    pubchem_search(cid=241, mock_test=True).get_atoms()
    pubchem_atoms_search(smiles='CCOH', mock_test=True)
    pubchem_atoms_conformer_search('octane', mock_test=True)
    # (maybe test something about some of the returned atoms)

    # check conformer searching
    confs = pubchem_conformer_search('octane', mock_test=True)
    for conf in confs:
        pass
    try:  # check that you can't pass in two args
        pubchem_search(name='octane', cid=222, mock_test=True)
        raise Exception('Test Failed')
    except ValueError:
        pass

    try:  # check that you must pass at least one arg
        pubchem_search(mock_test=True)
        raise Exception('Test Failed')
    except ValueError:
        pass