def test_all_defaults(self): # Tests correct instantiation with default values self.tect_reg = TectonicRegion('001', 'Test 0') self.assertEqual(self.tect_reg.id, '001') self.assertEqual(self.tect_reg.region_name, 'Test 0') self.assertAlmostEqual(self.tect_reg.shear_modulus[0][0], 30.0) self.assertAlmostEqual(self.tect_reg.shear_modulus[0][1], 1.0) self.assertAlmostEqual(self.tect_reg.disp_length_ratio[0][0], 1.25E-5) self.assertAlmostEqual(self.tect_reg.disp_length_ratio[0][1], 1.0) self.assertTrue(isinstance(self.tect_reg.scaling_rel[0][0], WC1994)) self.assertAlmostEqual(self.tect_reg.scaling_rel[0][1], 1.0)
def test_input_values(self): ''' Tests correct instantiation with input values ''' expected_dict = {'id': '001', 'region_name': 'Test 0', 'shear_modulus': [(28., 0.5), (32., 0.5)], 'disp_length_ratio': [(1.0E-4, 1.0)], 'scaling_rel': [(WC1994, 1.0)]} shear_mod = [(28., 0.5), (32., 0.5)] dlr = [(1.0E-4, 1.0)] msr = [(WC1994, 1.0)] self.tect_reg = TectonicRegion('001', 'Test 0', shear_modulus=shear_mod, disp_length_ratio=dlr, scaling_rel=msr) self.assertDictEqual(expected_dict, self.tect_reg.__dict__)