def test_invalid_color_scale_range(self):
     self.param["color_scale_range"] = ["-10a", "-34a"]
     v = pc.ParameterValidator(self.param, self.defaults)
     self.assertRaises(ex.InvalidParameterValueError, v.validate)
 def test_invalid_n_colors(self):
     self.param["n_colors"] = [
         "10a",
     ]
     v = pc.ParameterValidator(self.param, self.defaults)
     self.assertRaises(ex.InvalidParameterValueError, v.validate)
 def test_invalid_width(self):
     self.param["width"] = "a1024"
     v = pc.ParameterValidator(self.param, self.defaults)
     self.assertRaises(ex.InvalidParameterValueError, v.validate)
 def test_invalid_height(self):
     self.param["height"] = "e68"
     v = pc.ParameterValidator(self.param, self.defaults)
     self.assertRaises(ex.InvalidParameterValueError, v.validate)
 def test_missing_time_index(self):
     del self.param["time_index"]
     v = pc.ParameterValidator(self.param, self.defaults)
     v.validate()
     self.assertEquals(self.param["time_index"], \
                       self.defaults["time_index"])
 def test_missing_palette(self):
     del self.param["palette"]
     v = pc.ParameterValidator(self.param, self.defaults)
     v.validate()
     self.assertEquals(self.param["palette"], \
                       self.defaults["palette"])
 def test_missing_number_of_colors(self):
     del self.param["n_colors"]
     v = pc.ParameterValidator(self.param, self.defaults)
     v.validate()
     self.assertEquals(self.param["n_colors"], \
                       list( int(i) for i in (self.defaults["n_colors"])))
 def test_missing_color_scale_range(self):
     del self.param["color_scale_range"]
     v = pc.ParameterValidator(self.param, self.defaults)
     v.validate()
     self.assertEquals(self.param["color_scale_range"], \
                       [-4,4])
 def test_missing_source_url(self):
     del self.param["source_url"]
     v = pc.ParameterValidator(self.param, self.defaults)
     v.validate()
     self.assertEquals(self.param["source_url"], \
                       self.defaults["source_url"])
 def test_missing_width(self):
     del self.param["width"]
     v = pc.ParameterValidator(self.param, self.defaults)
     v.validate()
     self.assertEquals(self.param["width"], \
                       (int)(self.defaults["width"]))
 def test_all_valid(self):
     v = pc.ParameterValidator(self.param, self.defaults)
     v.validate()