Exemplo n.º 1
0
    def test_validate_formatter(self):
        """Validate formatter result according to Data Model."""
        # Setup
        raw = pd.read_csv('tests/fixtures/nasa.csv', index_col=0)

        data = nasa_formatter(raw)

        # Check.
        check_dataset_format(data)
Exemplo n.º 2
0
    def test_missing_ordered_geopolitical_divisions(self):
        """If lower geopolitical levels are missing, but well ordered, no exeption is raised."""
        # Setup
        data = pd.DataFrame([{
            'country': 'xxx',
            'region': 'yyy',
        }])

        # Run / Check
        check_dataset_format(data)
Exemplo n.º 3
0
    def test_cds_formatter(self):
        """Validate formatter output for datasource xxx."""
        # Setup
        fixture = pd.read_csv('tests/fixtures/cds.csv')

        # Run
        data = cds_formatter(fixture)

        # Check
        check_dataset_format(data)
Exemplo n.º 4
0
    def test_validate_formatter(self):
        """Validate formatter result according to Data Model."""
        # Setup
        raw = pd.read_csv('tests/fixtures/noaa_fixture.csv')

        # Run
        data = noaa_api_formatter(raw)

        # Check
        check_dataset_format(data)
Exemplo n.º 5
0
    def test_validate_formatter_country_aggr(self):
        """Validate formatter result when country_avg is present."""
        # Setup
        raw = pd.read_csv('tests/fixtures/noaa_fixture.csv')

        # Run
        data = noaa_api_formatter(raw, country_aggr=True)

        # Check
        check_dataset_format(data)
    def test_formatter_valid_output(self):
        """Check that the formatter output is compliant with the Data Model specification."""
        # Setup
        raw = pd.read_csv('tests/fixtures/mobility.csv')

        # Run
        data = mobility_formatter(raw)

        # Check
        check_dataset_format(data)
    def test_validate_formatter(self):
        """ Validate formatter result according to Data Model"""
        # Setup
        raw = pd.read_csv('tests/fixtures/es_covid_fixture.csv')

        # Run
        data = es_covid_formatter(raw)

        # Check.
        check_dataset_format(data)
Exemplo n.º 8
0
    def test_validate_format_raw_output(self):
        """Validate datasource output.

        This tests is skipped intentionally on the main suite due to it taking to long.
        Is kept for developing porpouses.
        """
        # Setup
        start_date = datetime(2020, 1, 1)
        end_date = datetime(2020, 1, 15)
        countries = ['BE']

        # Run
        data = noaa_api(countries, start_date, end_date)

        # Check
        check_dataset_format(data)
Exemplo n.º 9
0
    def test_missing_unordered_geopolitical_divisions(self):
        """If lower geopolitical levels are missing, and unordered, and exception is raised."""
        # Setup
        data = pd.DataFrame([{
            'region': 'yyy',
            'country': 'xxx',
        }])

        expected_exception_message = (
            'The correct ordening of the columns is "country, region, sub_region, city"'
        )

        # Run
        with self.assertRaises(AssertionError) as error:
            check_dataset_format(data)

        # Check
        assert error.exception.args[0] == expected_exception_message