• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python helpers.deep_eq函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中tests.utils.helpers.deep_eq函数的典型用法代码示例。如果您正苦于以下问题:Python deep_eq函数的具体用法?Python deep_eq怎么用?Python deep_eq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了deep_eq函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_invalid_disagg_calc

    def test_invalid_disagg_calc(self):
        expected_errors = {
            'mag_bin_width': ['Magnitude bin width must be > 0.0'],
            'distance_bin_width': ['Distance bin width must be > 0.0'],
            'coordinate_bin_width': ['Coordinate bin width must be > 0.0'],
            'num_epsilon_bins': ['Number of epsilon bins must be > 0'],
            'truncation_level': ['Truncation level must be > 0 for'
                                 ' disaggregation calculations'],
            'poes_disagg': ['PoEs for disaggregation must be in the range'
                            ' [0, 1]'],
        }

        self.hc.mag_bin_width = 0.0
        self.hc.distance_bin_width = 0.0
        self.hc.coordinate_bin_width = 0.0  # decimal degrees
        self.hc.num_epsilon_bins = 0
        self.hc.poes_disagg = [1.00001, -0.5, 0.0]
        self.hc.truncation_level = 0.0

        form = validation.DisaggHazardForm(instance=self.hc, files=None)

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)

        # test with an empty `poes_disagg` list
        self.hc.poes_disagg = []
        form = validation.DisaggHazardForm(instance=self.hc, files=None)
        expected_errors['poes_disagg'] = [(
            '`poes_disagg` must contain at least 1 value')]
        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:Chunghan,项目名称:oq-engine,代码行数:33,代码来源:validation_test.py


示例2: test_invalid_disagg_calc

    def test_invalid_disagg_calc(self):
        expected_errors = {
            'mag_bin_width': ['Magnitude bin width must be > 0.0'],
            'distance_bin_width': ['Distance bin width must be > 0.0'],
            'coordinate_bin_width': ['Coordinate bin width must be > 0.0'],
            'num_epsilon_bins': ['Number of epsilon bins must be > 0'],
            'truncation_level': ['Truncation level must be > 0 for'
                                 ' disaggregation calculations'],
            'poes_disagg': ['PoEs for disaggregation must be in the range'
                            ' [0, 1]'],
        }

        hc = models.HazardCalculation(
            owner=helpers.default_user(),
            description='',
            sites='MULTIPOINT((-122.114 38.113))',
            calculation_mode='disaggregation',
            random_seed=37,
            number_of_logic_tree_samples=1,
            rupture_mesh_spacing=0.001,
            width_of_mfd_bin=0.001,
            area_source_discretization=0.001,
            reference_vs30_value=0.001,
            reference_vs30_type='measured',
            reference_depth_to_2pt5km_per_sec=0.001,
            reference_depth_to_1pt0km_per_sec=0.001,
            investigation_time=1.0,
            intensity_measure_types_and_levels=VALID_IML_IMT_STR,
            truncation_level=0.0,
            maximum_distance=100.0,
            mag_bin_width=0.0,
            distance_bin_width=0.0,
            coordinate_bin_width=0.0,  # decimal degrees
            num_epsilon_bins=0,
            poes_disagg=[1.00001, -0.5, 0.0],
        )
        form = validation.DisaggHazardForm(instance=hc, files=None)

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)

        # test with an empty `poes_disagg` list
        hc.poes_disagg = []
        form = validation.DisaggHazardForm(instance=hc, files=None)
        expected_errors['poes_disagg'] = [(
            '`poes_disagg` must contain at least 1 value')]
        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:4x,项目名称:oq-engine,代码行数:50,代码来源:validation_test.py


示例3: test_invalid_scenario_calc

    def test_invalid_scenario_calc(self):
        expected_errors = {
            'gsim': ["The gsim u'BooreAtkinson208' is not in in \
openquake.hazardlib.gsim"],
            'number_of_ground_motion_fields': [
                'The number_of_ground_motion_fields must be a positive '
                'integer, got -10']
        }

        hc = models.HazardCalculation(
            owner=helpers.default_user(),
            description='',
            sites='MULTIPOINT((-122.114 38.113))',
            calculation_mode='scenario',
            random_seed=37,
            rupture_mesh_spacing=0.001,
            reference_vs30_value=0.001,
            reference_vs30_type='measured',
            reference_depth_to_2pt5km_per_sec=0.001,
            reference_depth_to_1pt0km_per_sec=0.001,
            intensity_measure_types=VALID_IML_IMT.keys(),
            truncation_level=0.1,
            maximum_distance=100.0,
            gsim='BooreAtkinson208',
            ground_motion_correlation_model='JB2009',
            number_of_ground_motion_fields=-10,
        )
        form = validation.ScenarioHazardForm(
            instance=hc, files=None
        )

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:4x,项目名称:oq-engine,代码行数:34,代码来源:validation_test.py


示例4: test_complete_logic_tree_gmf_iter

    def test_complete_logic_tree_gmf_iter(self):
        job = models.OqJob.objects.latest('id')
        # Test data:
        td = gmf_set_iter_test_data

        exp_gmfs = itertools.chain(
            td.GMFS_GMF_SET_0, td.GMFS_GMF_SET_1, td.GMFS_GMF_SET_2,
            td.GMFS_GMF_SET_3, td.GMFS_GMF_SET_4, td.GMFS_GMF_SET_5)
        exp_gmf_set = FakeGmfSet(complete_logic_tree_gmf=True,
                                 ses_ordinal=None,
                                 investigation_time=60.0,
                                 gmfs=exp_gmfs)

        [act_gmf_set] = models.GmfSet.objects\
            .filter(gmf_collection__output__oq_job=job.id,
                    gmf_collection__lt_realization__isnull=True)\
            .order_by('id')

        self.assertEqual(len(list(exp_gmf_set)), len(list(act_gmf_set)))

        self.assertEqual(exp_gmf_set.complete_logic_tree_gmf,
                         act_gmf_set.complete_logic_tree_gmf)
        self.assertEqual(exp_gmf_set.ses_ordinal, act_gmf_set.ses_ordinal)
        self.assertEqual(exp_gmf_set.investigation_time,
                         act_gmf_set.investigation_time)

        for i, exp_gmf in enumerate(exp_gmf_set):
            act_gmf = list(act_gmf_set)[i]

            equal, error = helpers.deep_eq(exp_gmf, act_gmf)

            self.assertTrue(equal, error)
开发者ID:matley,项目名称:oq-engine,代码行数:32,代码来源:models_test.py


示例5: test_iter

    def test_iter(self):
        # Test data
        td = gmf_set_iter_test_data

        exp_gmf_sets = [
            FakeGmfSet(complete_logic_tree_gmf=False, ses_ordinal=1, investigation_time=10.0, gmfs=td.GMFS_GMF_SET_0),
            FakeGmfSet(complete_logic_tree_gmf=False, ses_ordinal=2, investigation_time=10.0, gmfs=td.GMFS_GMF_SET_1),
            FakeGmfSet(complete_logic_tree_gmf=False, ses_ordinal=3, investigation_time=10.0, gmfs=td.GMFS_GMF_SET_2),
            FakeGmfSet(complete_logic_tree_gmf=False, ses_ordinal=1, investigation_time=10.0, gmfs=td.GMFS_GMF_SET_3),
            FakeGmfSet(complete_logic_tree_gmf=False, ses_ordinal=2, investigation_time=10.0, gmfs=td.GMFS_GMF_SET_4),
            FakeGmfSet(complete_logic_tree_gmf=False, ses_ordinal=3, investigation_time=10.0, gmfs=td.GMFS_GMF_SET_5),
        ]

        job = models.OqJob.objects.latest("id")

        gmf_sets = models.GmfSet.objects.filter(
            gmf_collection__output__oq_job=job.id, gmf_collection__lt_realization__isnull=False
        ).order_by("gmf_collection", "ses_ordinal")

        for i, exp_gmf_set in enumerate(exp_gmf_sets):
            act_gmf_set = gmf_sets[i]
            self.assertEqual(exp_gmf_set.complete_logic_tree_gmf, act_gmf_set.complete_logic_tree_gmf)
            self.assertEqual(exp_gmf_set.ses_ordinal, act_gmf_set.ses_ordinal)
            self.assertEqual(exp_gmf_set.investigation_time, act_gmf_set.investigation_time)

            for j, exp_gmf in enumerate(exp_gmf_set):
                act_gmf = list(act_gmf_set)[j]

                equal, error = helpers.deep_eq(exp_gmf, act_gmf)

                self.assertTrue(equal, error)
开发者ID:gvallarelli,项目名称:oq-engine,代码行数:31,代码来源:models_test.py


示例6: test_serialize

    def test_serialize(self):
        parser = nrml_parsers.SourceModelParser(MIXED_SRC_MODEL)
        source_model = parser.parse()

        inp = models.Input(
            owner=helpers.default_user(),
            digest='fake',
            path='fake',
            input_type='source',
            size=0
        )
        inp.save()

        db_writer = source_input.SourceDBWriter(
            inp, source_model, MESH_SPACING, BIN_WIDTH, AREA_SRC_DISC
        )
        db_writer.serialize()

        # Check that everything was saved properly.

        # First, check the Input:
        # refresh the record
        [inp] = models.Input.objects.filter(id=inp.id)
        self.assertEquals(source_model.name, inp.name)

        # re-reparse the test file for comparisons:
        nrml_sources = list(
            nrml_parsers.SourceModelParser(MIXED_SRC_MODEL).parse()
        )

        parsed_sources = list(models.ParsedSource.objects.filter(input=inp.id))

        # compare pristine nrml sources to those stored in pickled form in the
        # database (by unpickling them first, of course):
        for i, ns in enumerate(nrml_sources):
            self.assertTrue(*helpers.deep_eq(ns, parsed_sources[i].nrml))

        # now check that the ParsedSource geometry is correct
        # it should be the same as the 'rupture-enclosing' geometry for the
        # nhlib representation of each source
        for i, (ns, ps) in enumerate(zip(nrml_sources, parsed_sources)):
            nhlib_src = source_input.nrml_to_nhlib(
                ns, MESH_SPACING, BIN_WIDTH, AREA_SRC_DISC
            )

            nhlib_poly = nhlib_src.get_rupture_enclosing_polygon()
            # nhlib tests the generation of wkt from a polygon, so we can trust
            # that it is well-formed.

            # Since we save the rupture enclosing polygon as geometry (not wkt)
            # in the database, the WKT we get back from the DB might have
            # slightly different coordinate values (a difference in precision).
            # shapely can help us compare two polygons (generated from wkt)
            # at a specific level of precision (default=6 digits after the
            # decimal point).
            expected_poly = wkt.loads(ps.polygon.wkt)
            actual_poly = wkt.loads(nhlib_poly.wkt)

            self.assertTrue(expected_poly.almost_equals(actual_poly))
开发者ID:angri,项目名称:openquake,代码行数:59,代码来源:source_test.py


示例7: test_characteristic_multi

    def test_characteristic_multi(self):
        exp = self._expected_char_multi
        actual = source_input.nrml_to_hazardlib(
            self.char_multi, MESH_SPACING, BIN_WIDTH, AREA_SRC_DISC
        )

        eq, msg = helpers.deep_eq(exp, actual)

        self.assertTrue(eq, msg)
开发者ID:chenliu0831,项目名称:oq-engine,代码行数:9,代码来源:source_test.py


示例8: test_simple_to_hazardlib

    def test_simple_to_hazardlib(self):
        exp = self._expected_simple
        actual = source_input.nrml_to_hazardlib(
            self.simple, MESH_SPACING, BIN_WIDTH, AREA_SRC_DISC
        )

        eq, msg = helpers.deep_eq(exp, actual)

        self.assertTrue(eq, msg)
开发者ID:4x,项目名称:oq-engine,代码行数:9,代码来源:source_test.py


示例9: test_characteristic_complex

    def test_characteristic_complex(self):
        exp = self._expected_char_complex
        actual = source_input.nrml_to_hazardlib(
            self.char_complex, 10, BIN_WIDTH, AREA_SRC_DISC
        )

        eq, msg = helpers.deep_eq(exp, actual)

        self.assertTrue(eq, msg)
开发者ID:chenliu0831,项目名称:oq-engine,代码行数:9,代码来源:source_test.py


示例10: test_complex_to_nhlib

    def test_complex_to_nhlib(self):
        exp = self._expected_complex
        actual = source_input.nrml_to_nhlib(
            self.cmplx, MESH_SPACING, BIN_WIDTH, AREA_SRC_DISC
        )

        eq, msg = helpers.deep_eq(exp, actual)

        self.assertTrue(eq, msg)
开发者ID:angri,项目名称:openquake,代码行数:9,代码来源:source_test.py


示例11: test_hazard_curves_from_gmf_invalid_iml_imt

    def test_hazard_curves_from_gmf_invalid_iml_imt(self):
        # Test a configuration where the user has requested to post-process
        # GMFs into hazard curves.
        # In this case, the configuration has the required
        # `intensity_measure_types_and_levels`, but the IMTs are not a subset
        # of `intensity_measure_types`.
        expected_errors = {
            'intensity_measure_types_and_levels': [
                'Unknown IMT(s) [SA(0)] in `intensity_measure_types`'],
        }
        iml_imt = VALID_IML_IMT.keys()
        iml_imt.pop()

        hc = models.HazardCalculation(
            owner=helpers.default_user(),
            description='',
            region=(
                'POLYGON((-122.0 38.113, -122.114 38.113, -122.57 38.111, '
                '-122.0 38.113))'
            ),
            region_grid_spacing=0.001,
            calculation_mode='event_based',
            random_seed=37,
            number_of_logic_tree_samples=1,
            rupture_mesh_spacing=0.001,
            width_of_mfd_bin=0.001,
            area_source_discretization=0.001,
            reference_vs30_value=0.001,
            reference_vs30_type='measured',
            reference_depth_to_2pt5km_per_sec=0.001,
            reference_depth_to_1pt0km_per_sec=0.001,
            investigation_time=1.0,
            intensity_measure_types=iml_imt,
            intensity_measure_types_and_levels=VALID_IML_IMT,
            truncation_level=0.0,
            maximum_distance=100.0,
            ses_per_logic_tree_path=5,
            ground_motion_correlation_model='JB2009',
            ground_motion_correlation_params={"vs30_clustering": True},
            complete_logic_tree_ses=False,
            complete_logic_tree_gmf=True,
            ground_motion_fields=True,
            hazard_curves_from_gmfs=True,
        )
        form = validation.EventBasedHazardForm(
            instance=hc, files=None
        )

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:4x,项目名称:oq-engine,代码行数:51,代码来源:validation_test.py


示例12: test_invalid_disagg_calc_truncation_not_set

    def test_invalid_disagg_calc_truncation_not_set(self):
        expected_errors = {
            'mag_bin_width': ['Magnitude bin width must be > 0.0'],
            'distance_bin_width': ['Distance bin width must be > 0.0'],
            'coordinate_bin_width': ['Coordinate bin width must be > 0.0'],
            'num_epsilon_bins': ['Number of epsilon bins must be > 0'],
            'truncation_level': ['Truncation level must be set for'
                                 ' disaggregation calculations'],
            'poes_disagg': ['PoEs for disaggregation must be in the range'
                            ' [0, 1]'],
        }

        self.hc.truncation_level = None
        self.hc.mag_bin_width = 0.0
        self.hc.distance_bin_width = 0.0
        self.hc.coordinate_bin_width = 0.0  # decimal degrees
        self.hc.num_epsilon_bins = 0
        self.hc.poes_disagg = [1.00001, -0.5, 0.0]

        form = validation.DisaggHazardForm(instance=self.hc, files=None)

        self.assertFalse(form.is_valid())
        helpers.deep_eq(expected_errors, dict(form.errors))
开发者ID:Chunghan,项目名称:oq-engine,代码行数:23,代码来源:validation_test.py


示例13: test_hazard_calculation_is_not_valid_missing_grid_spacing

    def test_hazard_calculation_is_not_valid_missing_grid_spacing(self):
        expected_errors = {
            'region': ['`region` requires `region_grid_spacing`'],
        }

        self.hc.region_grid_spacing = None

        form = validation.ClassicalHazardForm(
            instance=self.hc, files=None
        )

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:Chunghan,项目名称:oq-engine,代码行数:14,代码来源:validation_test.py


示例14: test_hazard_calculation_is_not_valid_region_only

    def test_hazard_calculation_is_not_valid_region_only(self):
        expected_errors = {
            'region_grid_spacing': ['Region grid spacing must be > 0'],
            'region': [
                'Invalid region geomerty: Self-intersection[0 0]',
                'Region geometry can only be a single linear ring',
                'Longitude values must in the range [-180, 180]',
                'Latitude values must be in the range [-90, 90]'],
            'reference_vs30_value': ['Reference VS30 value must be > 0'],
            'reference_vs30_type': [
                'Reference VS30 type must be either "measured" or "inferred"',
            ],
            'reference_depth_to_1pt0km_per_sec': [
                'Reference depth to 1.0 km/sec must be > 0',
            ],
            'reference_depth_to_2pt5km_per_sec': [
                'Reference depth to 2.5 km/sec must be > 0',
            ],
        }

        hc = models.HazardCalculation(
            owner=helpers.default_user(),
            description='',
            region=(
                'POLYGON((-180.001 90.001, 180.001 -90.001, -179.001 -89.001, '
                '179.001 89.001, -180.001 90.001), (1 1, 2 2, 3 3, 4 4, 1 1))'
            ),
            region_grid_spacing=0,
            calculation_mode='classical',
            random_seed=2147483647,
            number_of_logic_tree_samples=1,
            rupture_mesh_spacing=1,
            width_of_mfd_bin=1,
            area_source_discretization=1,
            investigation_time=1,
            intensity_measure_types_and_levels=VALID_IML_IMT,
            truncation_level=0,
            maximum_distance=1,
            quantile_hazard_curves=[0.0, 0.1, 1.0],
            poes_hazard_maps=[1.0, 0.5, 0.0],
        )

        form = validation.ClassicalHazardForm(
            instance=hc, files=None
        )

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:4x,项目名称:oq-engine,代码行数:49,代码来源:validation_test.py


示例15: test_ses_per_logic_tree_path_is_not_valid

    def test_ses_per_logic_tree_path_is_not_valid(self):
        expected_errors = {
            'ses_per_logic_tree_path': [
                '`Stochastic Event Sets Per Sample` (ses_per_logic_tree_path) '
                'must be > 0'],
        }

        self.hc.ses_per_logic_tree_path = -1

        form = validation.EventBasedHazardForm(
            instance=self.hc, files=None
        )
        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:Chunghan,项目名称:oq-engine,代码行数:15,代码来源:validation_test.py


示例16: test_hazard_calculation_is_not_valid_missing_export_dir

    def test_hazard_calculation_is_not_valid_missing_export_dir(self):
        # When the user specifies '--exports' on the command line the
        # 'export_dir' parameter must be present in the .ini file.
        err = ('--exports specified on the command line but the '
               '"export_dir" parameter is missing in the .ini file')
        expected_errors = {
            'export_dir': [err],
        }

        form = validation.ClassicalHazardForm(
            instance=self.hc, files=None, exports=['xml']
        )
        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:Chunghan,项目名称:oq-engine,代码行数:15,代码来源:validation_test.py


示例17: test_gmfs_false_hazard_curves_true

    def test_gmfs_false_hazard_curves_true(self):
        # An error should be raised if `hazard_curves_from_gmfs` is `True`, but
        # `ground_motion_fields` is `False`.
        # GMFs are needed to compute hazard curves.
        expected_errors = {
            'hazard_curves_from_gmfs': ['`hazard_curves_from_gmfs` requires '
                                        '`ground_motion_fields` to be `true`'],
        }
        self.hc.ground_motion_fields = False
        self.hc.hazard_curves_from_gmfs = True

        form = validation.EventBasedHazardForm(instance=self.hc, files=None)

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:Chunghan,项目名称:oq-engine,代码行数:16,代码来源:validation_test.py


示例18: test_invalid_imts

    def test_invalid_imts(self):
        expected_errors = {
            'intensity_measure_types': [
                'SA(-0.1): SA period values must be >= 0',
                ('SA<2.5>: SA must be specified with a period value, in the '
                 'form `SA(N)`, where N is a value >= 0'),
                'SA(2x): SA period value should be a float >= 0',
                'PGZ: Invalid intensity measure type',
            ],
        }

        hc = models.HazardCalculation(
            owner=helpers.default_user(),
            description='',
            region=(
                'POLYGON((-122.0 38.113, -122.114 38.113, -122.57 38.111, '
                '-122.0 38.113))'
            ),
            region_grid_spacing=0.001,
            calculation_mode='event_based',
            random_seed=37,
            number_of_logic_tree_samples=1,
            rupture_mesh_spacing=0.001,
            width_of_mfd_bin=0.001,
            area_source_discretization=0.001,
            reference_vs30_value=0.001,
            reference_vs30_type='measured',
            reference_depth_to_2pt5km_per_sec=0.001,
            reference_depth_to_1pt0km_per_sec=0.001,
            investigation_time=1.0,
            intensity_measure_types=INVALID_IML_IMT.keys(),
            truncation_level=0.0,
            maximum_distance=100.0,
            ses_per_logic_tree_path=5,
            ground_motion_correlation_model='JB2009',
            ground_motion_correlation_params={"vs30_clustering": True},
            complete_logic_tree_ses=False,
            complete_logic_tree_gmf=True,
            ground_motion_fields=True,
        )
        form = validation.EventBasedHazardForm(
            instance=hc, files=None
        )

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:4x,项目名称:oq-engine,代码行数:47,代码来源:validation_test.py


示例19: test_area_with_tgr_mfd

    def test_area_with_tgr_mfd(self):
        area_mfd = nrml_models.TGRMFD(a_val=-3.5, b_val=1.0,
                                      min_mag=5.0, max_mag=6.5)
        self.area_source_attrib['mfd'] = area_mfd

        area_source = nrml_models.AreaSource(**self.area_source_attrib)

        # Re-scaled MFD for the points
        point_mfd = nrml_models.TGRMFD(a_val=-4.1020599913279625, b_val=1.0,
                                       min_mag=5.0, max_mag=6.5)
        for exp in self.expected:
            exp.mfd = point_mfd

        actual = list(source_input.area_source_to_point_sources(area_source,
                                                                100))
        equal, err = helpers.deep_eq(self.expected, actual)
        self.assertTrue(equal, err)
开发者ID:chenliu0831,项目名称:oq-engine,代码行数:17,代码来源:source_test.py


示例20: test_invalid_params_complet_lt_gmf_with_eb_enum

    def test_invalid_params_complet_lt_gmf_with_eb_enum(self):
        # When the `complete_logic_tree_gmf` is requested with end-branch
        # enumeration, this is not allowed. (The complete LT GMF is not a
        # useful artifact in this case.)
        expected_errors = {
            'complete_logic_tree_gmf': [
                '`complete_logic_tree_gmf` is not available with end branch '
                'enumeration'],
        }

        hc = models.HazardCalculation(
            owner=helpers.default_user(),
            description='',
            region=(
                'POLYGON((-122.0 38.113, -122.114 38.113, -122.57 38.111, '
                '-122.0 38.113))'
            ),
            region_grid_spacing=0.001,
            calculation_mode='event_based',
            random_seed=37,
            number_of_logic_tree_samples=0,
            rupture_mesh_spacing=0.001,
            width_of_mfd_bin=0.001,
            area_source_discretization=0.001,
            reference_vs30_value=0.001,
            reference_vs30_type='measured',
            reference_depth_to_2pt5km_per_sec=0.001,
            reference_depth_to_1pt0km_per_sec=0.001,
            investigation_time=1.0,
            intensity_measure_types=VALID_IML_IMT.keys(),
            truncation_level=0.0,
            maximum_distance=100.0,
            ses_per_logic_tree_path=5,
            ground_motion_correlation_model='JB2009',
            ground_motion_correlation_params={"vs30_clustering": True},
            complete_logic_tree_ses=False,
            complete_logic_tree_gmf=True,
            ground_motion_fields=True,
        )
        form = validation.EventBasedHazardForm(
            instance=hc, files=None
        )

        self.assertFalse(form.is_valid())
        equal, err = helpers.deep_eq(expected_errors, dict(form.errors))
        self.assertTrue(equal, err)
开发者ID:4x,项目名称:oq-engine,代码行数:46,代码来源:validation_test.py



注:本文中的tests.utils.helpers.deep_eq函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python helpers.demo_file函数代码示例发布时间:2022-05-27
下一篇:
Python utils.wrap函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap