예제 #1
0
def test_continuous_legend():
    """Test the LegendParameter continuous_legend property."""
    leg_par = LegendParameters()
    leg_par.continuous_legend = True

    assert leg_par.continuous_legend is True
    leg_par_copy = leg_par.duplicate()
    assert leg_par_copy.continuous_legend is True

    leg_par.continuous_legend = False
    assert leg_par.continuous_legend is False

    with pytest.raises(Exception):
        leg_par = LegendParameters(continuous_legend='yes')
    with pytest.raises(Exception):
        leg_par.continuous_legend = 'yes'
try:
    from ladybug.legend import LegendParameters
except ImportError as e:
    raise ImportError('\nFailed to import ladybug:\n\t{}'.format(e))

try:
    from ladybug_rhino.togeometry import to_plane
except ImportError as e:
    raise ImportError('\nFailed to import ladybug_rhino:\n\t{}'.format(e))

if colors_ == []:
    colors_ = None
if base_plane_:
    base_plane_ = to_plane(base_plane_)

leg_par = LegendParameters(min=min_,
                           max=max_,
                           segment_count=seg_count_,
                           colors=colors_,
                           base_plane=base_plane_)

leg_par.continuous_legend = continuous_leg_
leg_par.decimal_count = num_decimals_
leg_par.include_larger_smaller = larger_smaller_
leg_par.vertical = vert_or_horiz_
leg_par.segment_height = seg_height_
leg_par.segment_width = seg_width_
leg_par.text_height = text_height_
leg_par.font = font_