def test_find_min_max_with_empty_data(self):
     """
     An `Exception` is raised in case of empty data.
     """
     try:
         find_min_max([], lambda x: x)
     except Exception, e:
         self.assertEqual("Empty data set", e.args[0])
Esempio n. 2
0
 def test_find_min_max_with_empty_data(self):
     """
     An `Exception` is raised in case of empty data.
     """
     try:
         find_min_max([], lambda x: x)
     except Exception, e:
         self.assertEqual("Empty data set", e.args[0])
    def test_find_min_max_for_loss_maps(self):
        """
        Hazard map minimum and maximum values are found correctly.
        """
        data = [
            (['-118.229726', '34.050622'], 16.04934554846202),
            (['-118.241243', '34.061557'], 629.323267954),
            (['-118.245388', '34.055984'], 245.9928520658)]

        self.assertEqual((16.04934554846202, 629.323267954),
                         find_min_max(data, operator.itemgetter(1)))
    def test_find_min_max_for_hazard_maps(self):
        """
        Hazard map minimum and maximum values are found correctly.
        """
        data = [
            (['-121.8', '37.9'], '1.23518683436'),
            (['-122.0', '37.5'], '1.19244541041'),
            (['-122.1', '38.0'], '1.1905288226')]

        self.assertEqual((1.1905288226, 1.23518683436),
                         find_min_max(data, operator.itemgetter(1)))
Esempio n. 5
0
    def test_find_min_max_for_loss_maps(self):
        """
        Hazard map minimum and maximum values are found correctly.
        """
        data = [
            (['-118.229726', '34.050622'], 16.04934554846202),
            (['-118.241243', '34.061557'], 629.323267954),
            (['-118.245388', '34.055984'], 245.9928520658)]

        self.assertEqual((16.04934554846202, 629.323267954),
                         find_min_max(data, operator.itemgetter(1)))
Esempio n. 6
0
    def test_find_min_max_for_hazard_maps(self):
        """
        Hazard map minimum and maximum values are found correctly.
        """
        data = [
            (['-121.8', '37.9'], '1.23518683436'),
            (['-122.0', '37.5'], '1.19244541041'),
            (['-122.1', '38.0'], '1.1905288226')]

        self.assertEqual((1.1905288226, 1.23518683436),
                         find_min_max(data, operator.itemgetter(1)))