# Path: qcl/parse.py
# def parse(source):
#     """ Guess the identity of a particular file or data type and parse it.
# 
#         :source: Single file or data structure with some molecular data contained within
# 
#         :returns: ccData object with the molecular data parsed from source
# 
#         TODO
#     """
#     pass


import unittest
import numpy as np
from qcl import parse
"""Tests for parse.py"""





class ParseTest(unittest.TestCase):
    """Tests for parse.py"""

    def test_xyzfile(self):
        """Test for parse.xyzfile()"""
        ccdata = parse.xyzfile('../data/xyz/water.xyz')

        self.assertEqual(ccdata.charge, 0)
        self.assertEqual(ccdata.mult, 1)
        self.assertEqual(len(ccdata.atomnos), 3)

        atomnos = np.array([8, 1, 1])
        self.assertTrue(np.array_equal(ccdata.atomnos, atomnos))

        atomcoords = np.array([
            [-5.35740, 2.09256, 0.00000],
            [-4.38740, 2.09256, 0.00000],
            [-5.68073, 1.66625, -0.80909]])
        self.assertTrue(np.array_equal(ccdata.atomcoords, atomcoords))

    def test_xyzfile_ccdata_xyz(self):
        """Test for parse.xyzfile()"""

# Path: qcl/parse.py
# def parse(source):
#     """ Guess the identity of a particular file or data type and parse it.
# 
#         :source: Single file or data structure with some molecular data contained within
# 
#         :returns: ccData object with the molecular data parsed from source
# 
#         TODO
#     """
#     pass


# Path: test/test_parse.py
import unittest
import numpy as np
from qcl import parse

"""Tests for parse.py"""





class ParseTest(unittest.TestCase):
    """Tests for parse.py"""

    def test_xyzfile(self):
        """Test for parse.xyzfile()"""
        ccdata = parse.xyzfile('../data/xyz/water.xyz')

        self.assertEqual(ccdata.charge, 0)
        self.assertEqual(ccdata.mult, 1)
        self.assertEqual(len(ccdata.atomnos), 3)

        atomnos = np.array([8, 1, 1])
        self.assertTrue(np.array_equal(ccdata.atomnos, atomnos))

        atomcoords = np.array([
            [-5.35740, 2.09256, 0.00000],
            [-4.38740, 2.09256, 0.00000],
            [-5.68073, 1.66625, -0.80909]])
        self.assertTrue(np.array_equal(ccdata.atomcoords, atomcoords))

    def test_xyzfile_ccdata_xyz(self):
        """Test for parse.xyzfile()"""

        ccdata = parse.xyzfile('../data/xyz/S+MeO.xyz', ccxyz=True)