示例#1
0
 def test_get_statistics_above(self):
     mock_ngwmn.get_statistic = self.mock_stat
     stats = mock_ngwmn.get_statistics(self.test_agency_cd,
                                       self.test_site_no_above)
     self.assertEqual(
         'Water level in feet relative to NGW1701C',
         stats['overall']['alt_datum'],
         'When MEDIATION is AboveDatum then alt_datum is displayed.')
示例#2
0
    def test_get_statistics_no_ranked(self):
        mock_ngwmn.get_statistic = self.mock_stat
        stats = mock_ngwmn.get_statistics(self.test_agency_cd,
                                          self.test_site_no_no_ranked)
        self.assertEqual(
            'Depth to water, feet below land surface',
            stats['overall']['alt_datum'],
            'When MEDIATION is BelowLand then alt_datum is not displayed.')
        self.assertEqual(
            0, len(stats['monthly']),
            'With the site is not ranked there should be no monthly data and no mock exception thrown.'
        )

        overall = self.test_stats[self.test_agency_cd][
            self.test_site_no_below]['wl-overall']
        self.assertEqual(overall['CALC_DATE'], stats['overall']['calc_date'],
                         'Expect the calculated date.')
        self.assertEqual(overall['MIN_VALUE'], stats['overall']['min_value'],
                         'Expect the minimum value.')
        self.assertEqual(overall['MEDIAN_VALUE'],
                         stats['overall']['median_value'],
                         'Expect the median value.')
        self.assertEqual(overall['MAX_VALUE'], stats['overall']['max_value'],
                         'Expect the maximum value.')
        self.assertEqual(overall['MIN_DATE'], stats['overall']['min_date'],
                         'Expect the minimum date value.')
        self.assertEqual(overall['MAX_DATE'], stats['overall']['max_date'],
                         'Expect the maximum date value.')
        self.assertEqual(overall['SAMPLE_COUNT'],
                         stats['overall']['sample_count'],
                         'Expect the sample count value.')
        self.assertEqual(overall['RECORD_YEARS'],
                         stats['overall']['record_years'],
                         'Expect the record years value.')
        self.assertEqual(overall['LATEST_VALUE'],
                         stats['overall']['latest_value'],
                         'Expect the latest value.')
        self.assertEqual(overall['LATEST_PCTILE'],
                         stats['overall']['latest_pctile'],
                         'Expect the latest percentile.')
示例#3
0
    def test_get_statistics_below(self):
        mock_ngwmn.get_statistic = self.mock_stat
        stats = mock_ngwmn.get_statistics(self.test_agency_cd,
                                          self.test_site_no_below)
        self.assertEqual(
            'Depth to water, feet below land surface',
            stats['overall']['alt_datum'],
            'When MEDIATION is BelowLand then alt_datum is not displayed.')
        self.assertEqual(
            1, len(stats['monthly']),
            'With one month returned there should only be one entry.')
        self.assertEqual(
            'Jan', stats['monthly'][0]['month'],
            'Month numbers should be replaced with month abbrev.')

        jan = self.test_stats[self.test_agency_cd][
            self.test_site_no_below]['wl-monthly']['1']
        self.assertEqual(jan['P50_MIN'], stats['monthly'][0]['p50_min'],
                         'Expect the P50 minimum value.')
        self.assertEqual(jan['P10'], stats['monthly'][0]['p10'],
                         'Expect the P10 value.')
        self.assertEqual(jan['P25'], stats['monthly'][0]['p25'],
                         'Expect the P25 value.')
        self.assertEqual(jan['P50'], stats['monthly'][0]['p50'],
                         'Expect the P50 value.')
        self.assertEqual(jan['P75'], stats['monthly'][0]['p75'],
                         'Expect the P75 value.')
        self.assertEqual(jan['P90'], stats['monthly'][0]['p90'],
                         'Expect the P90 value.')
        self.assertEqual(jan['P50_MAX'], stats['monthly'][0]['p50_max'],
                         'Expect the P50 maximum value.')
        self.assertEqual(jan['SAMPLE_COUNT'],
                         stats['monthly'][0]['sample_count'],
                         'Expect the sample count value.')
        self.assertEqual(jan['RECORD_YEARS'],
                         stats['monthly'][0]['record_years'],
                         'Expect the record years value.')