Пример #1
0
    def test_creation_change():
        """Test Color - correct initilization"""
        value = "#FFF"
        color = param.Color(value=value)
        assert color.value == value

        value = "#FFFF00"
        color.value = value
        assert color.value == value
 def __init__(self):
     param.ParameterStore.__init__(self)
     self.param_int = param.Integer(value=666)
     self.param_num = param.Number(value=42.0)
     self.param_color = param.Color(value="#FFF000")
     self.param_choice = param.Choice(value="boo", choices=["boo", "baa"])
     self.param_str = param.String("hello", doc="Old doc")
     self.param_regex = param.String(value="127.0.0.1", regex=ip_regex)
     self.param_bool = param.Boolean(False)
     self.param_option = param.Option(value=None, choices=[True, False])
     self.param_range = param.Range(value=[-100, 100],
                                    hardbounds=[-200, None])
     self.param_list = param.List(value=[1, 2, 3], hardbounds=[0, 10])
Пример #3
0
 def test_creation_shorthex_bad():
     """Test Color - throw error due to incorrect initilization"""
     with pytest.raises(ValueError) as __:
         value = "FFFF"
         __ = param.Color(value=value)
Пример #4
0
 def test_creation_none():
     """Test Color - throw error due to incorrect initilization"""
     with pytest.raises(TypeError) as __:
         value = None
         __ = param.Color(value=value, allow_None=True)
Пример #5
0
 def test_creation_list():
     """Test Color - throw error due to incorrect initilization"""
     with pytest.raises(ValueError) as __:
         value = list()
         __ = param.Color(value=value)
Пример #6
0
    def test_kind():
        """Test Color - correct initilization"""
        value = "#FFF000"
        color = param.Color(value=value)

        assert color.kind == "Color"
Пример #7
0
 def test_creation_doc():
     """Test Color - correct initilization"""
     value = "#FFF000"
     doc = "I am a color"
     color = param.Color(value=value, doc=doc)
     assert color.doc == doc
Пример #8
0
 def test_creation_shorthex_nohash():
     """Test Color - correct initilization"""
     value = "FFF"
     color = param.Color(value=value)
     assert color.value == value