mirror of
https://github.com/wassname/simpeg.git
synced 2026-07-27 11:27:23 +08:00
Ability to run all tests at once.
Removed __init__.py added runTests.py and .sh so that we can run all tests at one time.
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
# init.py
|
||||
|
||||
from test_mesh import *
|
||||
@@ -0,0 +1,11 @@
|
||||
import glob
|
||||
import unittest
|
||||
|
||||
# This code will run all tests in directory named test_*.py
|
||||
|
||||
test_file_strings = glob.glob('test_*.py')
|
||||
module_strings = [str[0:len(str)-3] for str in test_file_strings]
|
||||
suites = [unittest.defaultTestLoader.loadTestsFromName(str) for str
|
||||
in module_strings]
|
||||
testSuite = unittest.TestSuite(suites)
|
||||
text_runner = unittest.TextTestRunner().run(testSuite)
|
||||
@@ -0,0 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
python -m unittest discover
|
||||
@@ -5,7 +5,7 @@ from BaseMesh import BaseMesh
|
||||
import numpy as np
|
||||
|
||||
|
||||
class TestMeshNumbers3D(unittest.TestCase):
|
||||
class TestBaseMesh(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.mesh = BaseMesh([6, 2, 3])
|
||||
|
||||
+7
-9
@@ -75,9 +75,15 @@ def mkvc(x, numDims=1):
|
||||
return x.flatten(order='F')[:, np.newaxis, np.newaxis]
|
||||
|
||||
|
||||
def ndgrid(xin):
|
||||
def ndgrid(*args):
|
||||
"""Form tensorial grid for 1, 2 and 3 dimensions. Return X1,X2,X3 arrays depending on the dimension"""
|
||||
|
||||
# you can either pass a list [x1, x2, x3] or each seperately
|
||||
if type(args[0]) == list:
|
||||
xin = args[0]
|
||||
else:
|
||||
xin = args
|
||||
|
||||
if len(xin) == 1:
|
||||
return xin
|
||||
elif len(xin) == 2:
|
||||
@@ -88,14 +94,6 @@ def ndgrid(xin):
|
||||
return np.c_[X1, X2, X3]
|
||||
|
||||
|
||||
def flattenF(x):
|
||||
return np.flatten(x, order='F')
|
||||
|
||||
|
||||
def printF(x):
|
||||
pass
|
||||
|
||||
|
||||
def ind2sub(shape, ind):
|
||||
# From the given shape, returns the subscrips of the given index
|
||||
revshp = []
|
||||
|
||||
Reference in New Issue
Block a user