From a50d424d0ab7dd4cc6a2d6fc94371fa65a0d89b2 Mon Sep 17 00:00:00 2001 From: David Luevano <55825613+luevano@users.noreply.github.com> Date: Wed, 18 Dec 2019 09:53:44 -0700 Subject: Fix test issues --- lj_matrix/__init__.py | 27 ++++++++++++++------------- lj_matrix/__main__.py | 10 +++++----- lj_matrix/c_matrix.py | 2 +- lj_matrix/do_ml.py | 6 +++--- lj_matrix/gauss_kernel.py | 2 +- lj_matrix/lj_matrix.py | 2 +- lj_matrix/read_qm7_data.py | 2 +- test/__init__.py | 22 ++++++++++++++++++++++ test/test_c_matrix.py | 33 +++++++++++++++++++++++++++++++++ 9 files changed, 81 insertions(+), 25 deletions(-) create mode 100644 test/__init__.py create mode 100644 test/test_c_matrix.py diff --git a/lj_matrix/__init__.py b/lj_matrix/__init__.py index 47d7e5013..5019bd51d 100644 --- a/lj_matrix/__init__.py +++ b/lj_matrix/__init__.py @@ -20,26 +20,27 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ -from misc import printc -from read_qm7_data import read_qm7_data, read_nc_data, reas_db_data -from c_matrix import c_matrix, c_matrix_multiple -from cholesky_solve import cholesky_solve -from do_ml import do_ml -from frob_norm import frob_norm -from gauss_kernel import gauss_kernel -from lj_matrix import lj_matrix, lj_matrix_multiple +from lj_matrix.misc import printc +from lj_matrix.read_qm7_data import read_nc_data, reas_db_data, read_qm7_data +from lj_matrix.c_matrix import c_matrix, c_matrix_multiple +from lj_matrix.lj_matrix import lj_matrix, lj_matrix_multiple +from lj_matrix.frob_norm import frob_norm +from lj_matrix.gauss_kernel import gauss_kernel +from lj_matrix.cholesky_solve import cholesky_solve +from lj_matrix.do_ml import do_ml + # If somebody does "from package import *", this is what they will # be able to access: __all__ = ['printc', - 'read_qm7_data', 'read_nc_data', 'reas_db_data', + 'read_qm7_data', 'c_matrix', 'c_matrix_multiple', - 'cholesky_solve', - 'do_ml', + 'lj_matrix', + 'lj_matrix_multiple', 'frob_norm', 'gauss_kernel', - 'lj_matrix', - 'lj_matrix_multiple'] + 'cholesky_solve', + 'do_ml'] diff --git a/lj_matrix/__main__.py b/lj_matrix/__main__.py index 5a0e95b94..0b2a7c6f8 100644 --- a/lj_matrix/__main__.py +++ b/lj_matrix/__main__.py @@ -24,11 +24,11 @@ import time from multiprocessing import Process, Pipe # import matplotlib.pyplot as plt import pandas as pd -from misc import printc -from read_qm7_data import read_qm7_data -from c_matrix import c_matrix_multiple -from lj_matrix import lj_matrix_multiple -from do_ml import do_ml +from lj_matrix.misc import printc +from lj_matrix.read_qm7_data import read_qm7_data +from lj_matrix.c_matrix import c_matrix_multiple +from lj_matrix.lj_matrix import lj_matrix_multiple +from lj_matrix.do_ml import do_ml # Test diff --git a/lj_matrix/c_matrix.py b/lj_matrix/c_matrix.py index 4de711a1b..f21ccfd8c 100644 --- a/lj_matrix/c_matrix.py +++ b/lj_matrix/c_matrix.py @@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import time -from misc import printc import math import numpy as np from numpy.linalg import eig +from lj_matrix.misc import printc def c_matrix(mol_data, diff --git a/lj_matrix/do_ml.py b/lj_matrix/do_ml.py index c88533e68..ba88a6fd8 100644 --- a/lj_matrix/do_ml.py +++ b/lj_matrix/do_ml.py @@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import time -from misc import printc import numpy as np -from gauss_kernel import gauss_kernel -from cholesky_solve import cholesky_solve +from lj_matrix.misc import printc +from lj_matrix.gauss_kernel import gauss_kernel +from lj_matrix.cholesky_solve import cholesky_solve def do_ml(desc_data, diff --git a/lj_matrix/gauss_kernel.py b/lj_matrix/gauss_kernel.py index 0dfc65d59..5dd8e6406 100644 --- a/lj_matrix/gauss_kernel.py +++ b/lj_matrix/gauss_kernel.py @@ -22,7 +22,7 @@ SOFTWARE. """ import math import numpy as np -from frob_norm import frob_norm +from lj_matrix.frob_norm import frob_norm def gauss_kernel(X_1, X_2, sigma): diff --git a/lj_matrix/lj_matrix.py b/lj_matrix/lj_matrix.py index 2a8e0d956..2a56a3cdf 100644 --- a/lj_matrix/lj_matrix.py +++ b/lj_matrix/lj_matrix.py @@ -21,10 +21,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. """ import time -from misc import printc import math import numpy as np from numpy.linalg import eig +from lj_matrix.misc import printc def lj_matrix(mol_data, diff --git a/lj_matrix/read_qm7_data.py b/lj_matrix/read_qm7_data.py index 068ea1a42..b54691fb0 100644 --- a/lj_matrix/read_qm7_data.py +++ b/lj_matrix/read_qm7_data.py @@ -24,7 +24,7 @@ import os import time import numpy as np import random -from misc import printc +from lj_matrix.misc import printc # 'periodic_table_of_elements.txt' retrieved from diff --git a/test/__init__.py b/test/__init__.py new file mode 100644 index 000000000..8b866e928 --- /dev/null +++ b/test/__init__.py @@ -0,0 +1,22 @@ +"""MIT License + +Copyright (c) 2019 David Luevano Alvarado + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +""" \ No newline at end of file diff --git a/test/test_c_matrix.py b/test/test_c_matrix.py new file mode 100644 index 000000000..a8bb5ae34 --- /dev/null +++ b/test/test_c_matrix.py @@ -0,0 +1,33 @@ +"""MIT License + +Copyright (c) 2019 David Luevano Alvarado + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. +""" +import unittest +from lj_matrix.c_matrix import c_matrix + + +class TestCMatrix(unittest.TestCase): + def test_c_matrix(self): + self.assertAlmostEqual(1, 1) + + +if __name__ == '__main__': + unittest.main() -- cgit v1.2.3-54-g00ecf