<s> """<STR_LIT>""" <EOL> from vispy . scene import visuals <EOL> from vispy . testing import ( requires_application , TestingCanvas , <EOL> run_tests_if_main , raises ) <EOL> from vispy . testing . image_tester import assert_image_approved <EOL> def create_colorbar ( pos , size , orientation ) : <EOL> colorbar = visuals . ColorBar ( pos = pos , <EOL> size = size , <EOL> orientation = orientation , <EOL> label_str = '<STR_LIT>' , <EOL> cmap = '<STR_LIT>' , <EOL> border_color = '<STR_LIT>' , <EOL> border_width = <NUM_LIT:2> ) <EOL> colorbar . label . color = '<STR_LIT>' <EOL> colorbar . label . font_size = <NUM_LIT:5> <EOL> colorbar . ticks [ <NUM_LIT:0> ] . color = '<STR_LIT>' <EOL> colorbar . ticks [ <NUM_LIT:0> ] . font_size = <NUM_LIT:5> <EOL> colorbar . ticks [ <NUM_LIT:1> ] . color = '<STR_LIT>' <EOL> colorbar . ticks [ <NUM_LIT:1> ] . font_size = <NUM_LIT:5> <EOL> return colorbar <EOL> @ requires_application ( ) <EOL> def test_colorbar_draw ( ) : <EOL> """<STR_LIT>""" <EOL> with TestingCanvas ( ) as c : <EOL> colorbar_top = create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> orientation = '<STR_LIT>' ) <EOL> c . draw_visual ( colorbar_top ) <EOL> assert_image_approved ( c . render ( ) , '<STR_LIT>' ) <EOL> colorbar_top . parent = None <EOL> colorbar_bottom = create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> orientation = '<STR_LIT>' ) <EOL> c . draw_visual ( colorbar_bottom ) <EOL> assert_image_approved ( c . render ( ) , '<STR_LIT>' ) <EOL> colorbar_bottom . parent = None <EOL> colorbar_left = create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> orientation = '<STR_LIT:left>' ) <EOL> c . draw_visual ( colorbar_left ) <EOL> assert_image_approved ( c . render ( ) , '<STR_LIT>' ) <EOL> colorbar_left . parent = None <EOL> colorbar_right = create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> orientation = '<STR_LIT:right>' ) <EOL> c . draw_visual ( colorbar_right ) <EOL> assert_image_approved ( c . render ( ) , '<STR_LIT>' ) <EOL> @ requires_application ( ) <EOL> def test_reactive_draw ( ) : <EOL> """<STR_LIT>""" <EOL> with TestingCanvas ( ) as c : <EOL> colorbar = create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> orientation = '<STR_LIT>' ) <EOL> c . draw_visual ( colorbar ) <EOL> colorbar . cmap = "<STR_LIT>" <EOL> assert_image_approved ( c . render ( ) , <EOL> '<STR_LIT>' ) <EOL> colorbar . clim = ( - <NUM_LIT:20> , <NUM_LIT:20> ) <EOL> assert_image_approved ( c . render ( ) , <EOL> '<STR_LIT>' ) <EOL> colorbar . label . text = "<STR_LIT>" <EOL> assert_image_approved ( c . render ( ) , <EOL> '<STR_LIT>' ) <EOL> colorbar . ticks [ <NUM_LIT:0> ] . color = "<STR_LIT>" <EOL> colorbar . ticks [ <NUM_LIT:1> ] . color = "<STR_LIT>" <EOL> assert_image_approved ( c . render ( ) , <EOL> '<STR_LIT>' ) <EOL> colorbar . border_width = <NUM_LIT:0> <EOL> assert_image_approved ( c . render ( ) , <EOL> '<STR_LIT>' ) <EOL> colorbar . border_width = <NUM_LIT:5> <EOL> colorbar . border_color = "<STR_LIT>" <EOL> assert_image_approved ( c . render ( ) , <EOL> '<STR_LIT>' ) <EOL> @ requires_application ( ) <EOL> def test_attributes ( ) : <EOL> """<STR_LIT>""" <EOL> with TestingCanvas ( ) : <EOL> with raises ( ValueError ) : <EOL> create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT:1> , <NUM_LIT:30> ) , <EOL> orientation = '<STR_LIT>' ) <EOL> with raises ( ValueError ) : <EOL> create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT:0> , <NUM_LIT:1> ) , <EOL> orientation = '<STR_LIT:right>' ) <EOL> with raises ( ValueError ) : <EOL> create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( - <NUM_LIT:10> , <NUM_LIT:1> ) , <EOL> orientation = '<STR_LIT:right>' ) <EOL> with raises ( ValueError ) : <EOL> create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT:1> , - <NUM_LIT:10> ) , <EOL> orientation = '<STR_LIT:right>' ) <EOL> with raises ( ValueError ) : <EOL> create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT:1> , <NUM_LIT:0> ) , <EOL> orientation = '<STR_LIT:right>' ) <EOL> with raises ( ValueError ) : <EOL> create_colorbar ( pos = ( <NUM_LIT:50> , <NUM_LIT:50> ) , <EOL> size = ( <NUM_LIT> , <NUM_LIT:4> ) , <EOL> orientation = '<STR_LIT>' ) <EOL> run_tests_if_main ( ) </s>
