def test_get_area_complex(self): ''' As the get area class simply implements the get_area() method of :class: openquake.hazardlib.geo.surface.complex_fault. ComplexFaultSurface this test simply checks that it is called. ''' self.fault = ComplexFaultGeometry(self.edges, 1.0) self.assertAlmostEqual(2767.2418367330, self.fault.get_area(), 5)
def test_instantiation_complex(self): ''' Tests instantiation of the class ''' self.fault = ComplexFaultGeometry(self.edges, 1.0) self.assertTrue( isinstance(self.fault.surface, complex_fault.ComplexFaultSurface)) self.assertEqual(self.fault.typology, 'Complex') self.assertAlmostEqual(self.fault.dip, 30.8283885, 5)
def test_instantiation_complex(self): ''' Tests instantiation of the class ''' self.fault = ComplexFaultGeometry(self.edges, 1.0) self.assertTrue(isinstance(self.fault.surface, complex_fault.ComplexFaultSurface)) self.assertEqual(self.fault.typology, 'Complex') self.assertAlmostEqual(self.fault.dip, 30.8283885, 5)
class TestComplexFaultGeometry(unittest.TestCase): ''' Tests the:w implementation of the :class: openquake.hmtk.faults.fault_geometries.ComplexFaultGeometry ''' def setUp(self): ''' Creates a complex fault typology ''' x0 = Point(30., 30., 0.) x1 = x0.point_at(30., 0., 30.) x2 = x1.point_at(30., 0., 60.) upper_edge = Line([x0, x1, x2]) lower_edge = Line([ x0.point_at(40., 20., 130.), x1.point_at(42., 25., 130.), x2.point_at(41., 22., 130.) ]) self.edges = [upper_edge, lower_edge] self.fault = None def test_instantiation_complex(self): ''' Tests instantiation of the class ''' self.fault = ComplexFaultGeometry(self.edges, 1.0) self.assertTrue( isinstance(self.fault.surface, complex_fault.ComplexFaultSurface)) self.assertEqual(self.fault.typology, 'Complex') self.assertAlmostEqual(self.fault.dip, 30.8283885, 5) def test_get_area_complex(self): ''' As the get area class simply implements the get_area() method of :class: openquake.hazardlib.geo.surface.complex_fault. ComplexFaultSurface this test simply checks that it is called. ''' self.fault = ComplexFaultGeometry(self.edges, 1.0) self.assertAlmostEqual(2767.2418367330, self.fault.get_area(), 5)
class TestComplexFaultGeometry(unittest.TestCase): ''' Tests the:w implementation of the :class: openquake.hmtk.faults.fault_geometries.ComplexFaultGeometry ''' def setUp(self): ''' Creates a complex fault typology ''' x0 = Point(30., 30., 0.) x1 = x0.point_at(30., 0., 30.) x2 = x1.point_at(30., 0., 60.) upper_edge = Line([x0, x1, x2]) lower_edge = Line([x0.point_at(40., 20., 130.), x1.point_at(42., 25., 130.), x2.point_at(41., 22., 130.)]) self.edges = [upper_edge, lower_edge] self.fault = None def test_instantiation_complex(self): ''' Tests instantiation of the class ''' self.fault = ComplexFaultGeometry(self.edges, 1.0) self.assertTrue(isinstance(self.fault.surface, complex_fault.ComplexFaultSurface)) self.assertEqual(self.fault.typology, 'Complex') self.assertAlmostEqual(self.fault.dip, 30.8283885, 5) def test_get_area_complex(self): ''' As the get area class simply implements the get_area() method of :class: openquake.hazardlib.geo.surface.complex_fault. ComplexFaultSurface this test simply checks that it is called. ''' self.fault = ComplexFaultGeometry(self.edges, 1.0) self.assertAlmostEqual(2767.2418367330, self.fault.get_area(), 5)