def setUp(self): from sas.models.LamellarModel import LamellarModel from sas.models.HayterMSAStructure import HayterMSAStructure from sas.models.MultiplicationModel import MultiplicationModel self.model = LamellarModel() self.model2 = HayterMSAStructure() self.model3 = MultiplicationModel(self.model, self.model2)
class TestLamella(unittest.TestCase): """ Unit tests for Lamella model """ def setUp(self): from sas.models.LamellarModel import LamellarModel self.comp = LamellarModel() def test1D(self): """ Test 1D model for a Lamellar """ self.assertAlmostEqual(self.comp.run(1.0), 5.6387e-5, 4) def test1D_2(self): """ Test 2D model for a Lamellar """ self.assertAlmostEqual(self.comp.run([1.0, 1.3]), 5.6387e-5, 4)
class TestLamellar(unittest.TestCase): """ Unit tests for calculate_ER (Lamellarmodel)""" def setUp(self): from sas.models.LamellarModel import LamellarModel self.comp = LamellarModel() def test(self): """ Test 1D model for a Lamellar """ #No finite number should return from Lamellar models. self.assertTrue(numpy.isfinite(self.comp.calculate_ER()))
class TestLamellarHayterM(unittest.TestCase): """ Unit tests for LamellarModel(Q) * HayterMSAStructure(Q) """ def setUp(self): from sas.models.LamellarModel import LamellarModel from sas.models.HayterMSAStructure import HayterMSAStructure from sas.models.MultiplicationModel import MultiplicationModel self.model = LamellarModel() self.model2 = HayterMSAStructure() self.model3 = MultiplicationModel(self.model, self.model2) #Radius of model1.calculate_ER should Not be finite. def test_multplication_radius(self): """ test multiplication model (check the effective radius & the output of the multiplication) """ #Check run self.assertFalse(numpy.isfinite(self.model3.run(0.1))) #check effective radius . self.assertTrue(numpy.isfinite(self.model.calculate_ER()))
def setUp(self): from sas.models.LamellarModel import LamellarModel self.comp = LamellarModel()