def _test_ruptures(self, expected_ruptures, source):
     ruptures = list(source.iter_ruptures())
     for rupture in ruptures:
         self.assertIsInstance(rupture, ParametricProbabilisticRupture)
         self.assertIs(rupture.temporal_occurrence_model, self.TOM)
         self.assertIs(rupture.tectonic_region_type, self.TRT)
         self.assertEqual(rupture.rake, self.RAKE)
     self.assertEqual(len(expected_ruptures), source.count_ruptures())
     for i in range(len(expected_ruptures)):
         expected_rupture, rupture = expected_ruptures[i], ruptures[i]
         self.assertAlmostEqual(rupture.mag, expected_rupture['mag'])
         self.assertAlmostEqual(rupture.rake, expected_rupture['rake'])
         self.assertAlmostEqual(rupture.occurrence_rate,
                                expected_rupture['occurrence_rate'])
         assert_mesh_is(self, rupture.surface, expected_rupture['surface'])
         self.assertEqual(rupture.hypocenter,
                          Point(*expected_rupture['hypocenter']))
         assert_angles_equal(self,
                             rupture.surface.get_strike(),
                             expected_rupture['strike'],
                             delta=0.5)
         assert_angles_equal(self,
                             rupture.surface.get_dip(),
                             expected_rupture['dip'],
                             delta=3)
 def _test_ruptures(self, expected_ruptures, source):
     ruptures = list(source.iter_ruptures())
     for rupture in ruptures:
         self.assertIsInstance(rupture, ParametricProbabilisticRupture)
         self.assertIs(rupture.temporal_occurrence_model, self.TOM)
         self.assertIs(rupture.tectonic_region_type, self.TRT)
         self.assertEqual(rupture.rake, self.RAKE)
     self.assertEqual(len(expected_ruptures), source.count_ruptures())
     for i in xrange(len(expected_ruptures)):
         expected_rupture, rupture = expected_ruptures[i], ruptures[i]
         self.assertAlmostEqual(rupture.mag, expected_rupture['mag'])
         self.assertAlmostEqual(rupture.rake, expected_rupture['rake'])
         self.assertAlmostEqual(rupture.occurrence_rate,
                                expected_rupture['occurrence_rate'])
         assert_mesh_is(self, rupture.surface,
                        expected_rupture['surface'])
         self.assertEqual(rupture.hypocenter,
                          Point(*expected_rupture['hypocenter']))
         assert_angles_equal(self, rupture.surface.get_strike(),
                             expected_rupture['strike'], delta=0.5)
         assert_angles_equal(self, rupture.surface.get_dip(),
                             expected_rupture['dip'], delta=3)