def test_font(): """Test the LegendParameter font property.""" leg_par = LegendParameters() leg_par.font = 'Times' assert leg_par.font == 'Times' leg_par_copy = leg_par.duplicate() assert leg_par_copy.font == 'Times' leg_par.font = 'Courier' assert leg_par.font == 'Courier' with pytest.raises(Exception): leg_par = LegendParameters(font=0) with pytest.raises(Exception): leg_par.font = 0
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_