Files
simpeg/code/tests/test_tensorMesh.py
T
Rowan Cockett 8e3e0e0faa TensorMesh now inherits BaseMesh (worked with Luz!)
tests for tensorMesh and utils (e.g. ndgrid) are included and pass

Split the TensorMesh into Grid and View
2013-07-09 19:50:40 -07:00

35 lines
882 B
Python

import numpy as np
import unittest
import sys
sys.path.append('../')
from TensorMesh import TensorMesh
class TestSequenceFunctions(unittest.TestCase):
def setUp(self):
a = np.array([1, 1, 1])
b = np.array([1, 2])
x0 = np.array([3, 5])
self.mesh2 = TensorMesh([a, b], x0)
def test_vectorN_2D(self):
testNx = np.array([3, 4, 5, 6])
testNy = np.array([5, 6, 8])
xtest = np.all(self.mesh2.vectorNx == testNx)
ytest = np.all(self.mesh2.vectorNy == testNy)
self.assertTrue(xtest and ytest)
def test_vectorCC_2D(self):
testNx = np.array([3.5, 4.5, 5.5])
testNy = np.array([5.5, 7])
xtest = np.all(self.mesh2.vectorCCx == testNx)
ytest = np.all(self.mesh2.vectorCCy == testNy)
self.assertTrue(xtest and ytest)
if __name__ == '__main__':
unittest.main()