<commit_before># Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake.  If not, see <http://www.gnu.org/licenses/>.

import os
from nose.plugins.attrib import attr
from unittest import skip
from numpy.testing import assert_almost_equal

from openquake import export
from qa_tests import _utils as qa_utils


# this test is skipped because of a bug in hazard.general.validate_site_model
# which breaks if the points in the site_model are in a line, see
# https://bugs.launchpad.net/openquake/+bug/1092056
# once the bug is fixed we can restore the test
class ScenarioHazardCase4TestCase(qa_utils.BaseQATestCase):

    @attr('qa', 'hazard', 'scenario')
    def test(self):
        cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
        job = self.run_hazard(cfg)
        [output] = export.core.get_outputs(job.id)
        actual = list(qa_utils.get_medians(output, 'PGA'))
        expected_medians = [0.41615372, 0.22797466, 0.1936226]

        assert_almost_equal(actual, expected_medians, decimal=2)
<commit_msg>removed old comment and unused import<commit_after># Copyright (c) 2010-2012, GEM Foundation.
#
# OpenQuake is free software: you can redistribute it and/or modify it
# under the terms of the GNU Affero General Public License as published
# by the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenQuake is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with OpenQuake.  If not, see <http://www.gnu.org/licenses/>.

import os
from nose.plugins.attrib import attr
from numpy.testing import assert_almost_equal

from openquake import export
from qa_tests import _utils as qa_utils


class ScenarioHazardCase4TestCase(qa_utils.BaseQATestCase):

    @attr('qa', 'hazard', 'scenario')
    def test(self):
        cfg = os.path.join(os.path.dirname(__file__), 'job.ini')
        job = self.run_hazard(cfg)
        [output] = export.core.get_outputs(job.id)
        actual = list(qa_utils.get_medians(output, 'PGA'))
        expected_medians = [0.41615372, 0.22797466, 0.1936226]

        assert_almost_equal(actual, expected_medians, decimal=2)

{'fraction_non_alphanumeric': 0.0816464237516869, 'fraction_numerical': 0.027327935222672066, 'mean_word_length': 4.120898100172711, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1675277', 'n_tokens_mistral': 939, 'n_tokens_neox': 863, 'n_words': 339}