Here are the examples of the python api bokeh.core.properties.Float taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
4 Examples
3
View Source File : test_validation.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_Float(self):
p = Float()
with pytest.raises(ValueError) as e:
p.validate("junk")
assert not str(e).endswith("ValueError")
def test_Int(self):
3
View Source File : test_validation.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_Float(self, detail):
p = Float()
with pytest.raises(ValueError) as e:
p.validate("junk", detail)
assert str(e).endswith("ValueError") == (not detail)
def test_Int(self, detail):
3
View Source File : test_properties.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_inheritance(self):
class Base(HasProps):
x = Int(12)
y = String("hello")
class Child(Base):
z = Float(3.14)
c = Child()
assert frozenset(['x', 'y', 'z']) == frozenset(c.properties())
assert c.y == "hello"
def test_set(self):
0
View Source File : test_properties.py
License : MIT License
Project Creator : rthorst
License : MIT License
Project Creator : rthorst
def test_accurate_dataspecs(self):
class Base(HasProps):
num = NumberSpec(12)
not_a_dataspec = Float(10)
class Mixin(HasProps):
mixin_num = NumberSpec(14)
class Sub(Base, Mixin):
sub_num = NumberSpec(16)
base = Base()
mixin = Mixin()
sub = Sub()
assert set(["num"]) == base.dataspecs()
assert set(["mixin_num"]) == mixin.dataspecs()
assert set(["num", "mixin_num", "sub_num"]) == sub.dataspecs()
assert dict(num=base.lookup("num")) == base.dataspecs_with_props()
assert dict(mixin_num=mixin.lookup("mixin_num")) == mixin.dataspecs_with_props()
assert dict(num=sub.lookup("num"), mixin_num=sub.lookup("mixin_num"), sub_num=sub.lookup("sub_num")) == sub.dataspecs_with_props()
def test_not_serialized(self):