Cavenfish / autogamess

This is a python module for automating Raman calculations using GAMESS(us).
MIT License
9 stars 8 forks source link

test failures #5

Closed shivupa closed 5 years ago

shivupa commented 5 years ago

I am getting two test failures.

First failure

If I create a new directory and try to do

import autogamess as ag

ag.new_project("./a", "a.csv", title="a")

where a.csv is input.csv the directory structure is

aaInps  aaLogs  aaSpreadsheets  a.csv  temp.py

So perhaps the correct directory structure needs to be changed?

Second failure

Looks like a numerical thing? Perhaps something like numpy allclose would work but the dictionary complicates things.

Full test failures below; let me know if I did anything wrong!

============================= test session starts ==============================
platform linux -- Python 3.7.3, pytest-5.0.1, py-1.8.0, pluggy-0.12.0 -- /usr/bin/python
cachedir: .pytest_cache
rootdir: /home/shiv/autogamess
collecting ... collected 12 items

test_imports.py::test_numpy_import PASSED                                [  8%]
test_imports.py::test_scipy_import PASSED                                [ 16%]
test_imports.py::test_pandas_import PASSED                               [ 25%]
test_imports.py::test_basis_set_exchange_import PASSED                   [ 33%]
test_imports.py::test_elements_import PASSED                             [ 41%]
test_imports.py::test_openpyxl_import PASSED                             [ 50%]
test_imports.py::test_autogamess_module PASSED                           [ 58%]
test_package.py::test_new_project FAILED                                 [ 66%]
test_package.py::test_input_builder PASSED                               [ 75%]
test_package.py::test_bond_length_and_angle PASSED                       [ 83%]
test_package.py::test_get_data FAILED                                    [ 91%]
test_package.py::test_find_bond_angle PASSED                             [100%]

=================================== FAILURES ===================================
_______________________________ test_new_project _______________________________

tmpdir = local('/tmp/pytest-of-shiv/pytest-18/test_new_project0')

    def test_new_project(tmpdir):
        ag.new_project(tmpdir.strpath, csvfile, title=title)

        a = fc.dircmp(tmpdir.strpath + title, './correct/NPtest/')
>       assert a.left_only == []
E       AssertionError: assert ['Inps', 'Logs'] == []
E         Left contains 2 more items, first extra item: 'Inps'
E         Full diff:
E         - ['Inps', 'Logs']
E         + []

test_package.py:15: AssertionError
________________________________ test_get_data _________________________________

    def test_get_data():
        optfile = './correct/GDtest/AG-test_H2O_B3LYP_CCD_opt.log'
        hesfile = './correct/GDtest/AG-test_H2O_B3LYP_CCD_hes.log'
        ramfile = './correct/GDtest/AG-test_H2O_B3LYP_CCD_raman.log'

        optdata = ag.get_data(optfile)
        hesdata = ag.get_data(hesfile)
        ramdata = ag.get_data(ramfile)

        bl = {'O-H Bond Length': '0.9689082029181745',
              'O-2H Bond Length': '0.9689082029181745',
              'H-O Bond Length': '0.9689082029181745',
              'H-2H Bond Length': '1.513601111',
              '2H-O Bond Length': '0.9689082029181745',
              '2H-H Bond Length': '1.513601111',}

        ba = {'H-O-2H Bond Angle': '1.7928060145579967',
              '2H-O-H Bond Angle': '1.7928060145579967',
              'O-H-2H Bond Angle': '0.6743933195158983',
              '2H-H-O Bond Angle': '0.6743933195158983',
              'O-2H-H Bond Angle': '0.6743933195158983',
              'H-2H-O Bond Angle': '0.6743933195158983'}

        vf = {'A1': ['1658.10', '3748.38'], 'B2': ['3849.75']}
        ir = {'A1': ['1.31680', '0.06712'], 'B2': ['0.46621']}
        ra = {'A1': ['6.244', '73.030'], 'B2': ['33.310']}

>       assert optdata.bond_lengths == bl
E       AssertionError: assert {'2H-H Bond L...9181744', ...} == {'2H-H Bond Le...9181745', ...}
E         Common items:
E         {'2H-H Bond Length': '1.513601111', 'H-2H Bond Length': '1.513601111'}
E         Differing items:
E         {'O-2H Bond Length': '0.9689082029181744'} != {'O-2H Bond Length': '0.9689082029181745'}
E         {'O-H Bond Length': '0.9689082029181744'} != {'O-H Bond Length': '0.9689082029181745'}
E         {'2H-O Bond Length': '0.9689082029181744'} != {'2H-O Bond Length': '0.9689082029181745'}
E         {'H-O Bond Length': '0.9689082029181744'} != {'H-O Bond Length': '0.9689082029181745'}
E         Full diff:
E         {'2H-H Bond Length': '1.513601111',
E         -  '2H-O Bond Length': '0.9689082029181744',
E         ?                                        ^
E         +  '2H-O Bond Length': '0.9689082029181745',
E         ?                                        ^
E         'H-2H Bond Length': '1.513601111',
E         -  'H-O Bond Length': '0.9689082029181744',
E         ?                                       ^
E         +  'H-O Bond Length': '0.9689082029181745',
E         ?                                       ^
E         -  'O-2H Bond Length': '0.9689082029181744',
E         ?                                        ^
E         +  'O-2H Bond Length': '0.9689082029181745',
E         ?                                        ^
E         -  'O-H Bond Length': '0.9689082029181744'}
E         ?                                       ^
E         +  'O-H Bond Length': '0.9689082029181745'}
E         ?                                       ^

test_package.py:73: AssertionError
=============================== warnings summary ===============================
/home/shiv/.local/lib/python3.7/site-packages/openpyxl/xml/functions.py:31
  /home/shiv/.local/lib/python3.7/site-packages/openpyxl/xml/functions.py:31: DeprecationWarning: defusedxml.lxml is no longer supported and will be removed in a future release.
    from defusedxml.lxml import fromstring as _fromstring, tostring

-- Docs: https://docs.pytest.org/en/latest/warnings.html
=============== 2 failed, 10 passed, 1 warnings in 0.58 seconds ================
Cavenfish commented 5 years ago

Hey @shivupa in terms of the errors:

1) The new_project function requires that you give title in the form of a directory string. So it should be title="a/" or else it won't work. I believe this is in the doc string, if not I will add it immediately.

2) The second error I will commit a fix for then close this issue.

Thanks!