<s> from __future__ import absolute_import <EOL> from nose . tools import raises <EOL> from plotly . graph_objs import ( Data , Figure , Layout , Scatter , Scatter3d , Scene , <EOL> XAxis , YAxis ) <EOL> import plotly . tools as tls <EOL> @ raises ( Exception ) <EOL> def test_print_grid_before_make_subplots ( ) : <EOL> fig = Figure ( ) <EOL> fig . print_grid ( ) <EOL> @ raises ( Exception ) <EOL> def test_append_trace_before_make_subplots ( ) : <EOL> trace = Scatter ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> fig = Figure ( ) <EOL> fig . append_trace ( trace , <NUM_LIT:2> , <NUM_LIT:2> ) <EOL> @ raises ( Exception ) <EOL> def test_append_trace_row_out_of_range ( ) : <EOL> trace = Scatter ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> fig = tls . make_subplots ( rows = <NUM_LIT:2> , cols = <NUM_LIT:3> ) <EOL> fig . append_trace ( trace , <NUM_LIT:10> , <NUM_LIT:2> ) <EOL> @ raises ( Exception ) <EOL> def test_append_trace_col_out_of_range ( ) : <EOL> trace = Scatter ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> fig = tls . make_subplots ( rows = <NUM_LIT:2> , cols = <NUM_LIT:3> ) <EOL> fig . append_trace ( trace , <NUM_LIT:2> , <NUM_LIT:0> ) <EOL> def test_append_scatter ( ) : <EOL> expected = Figure ( <EOL> data = Data ( [ <EOL> Scatter ( <EOL> x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , <EOL> y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] , <EOL> xaxis = '<STR_LIT>' , <EOL> yaxis = '<STR_LIT>' <EOL> ) <EOL> ] ) , <EOL> layout = Layout ( <EOL> xaxis1 = XAxis ( <EOL> domain = [ <NUM_LIT:0.0> , <NUM_LIT> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> xaxis2 = XAxis ( <EOL> domain = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> xaxis3 = XAxis ( <EOL> domain = [ <NUM_LIT> , <NUM_LIT:1.0> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> xaxis4 = XAxis ( <EOL> domain = [ <NUM_LIT:0.0> , <NUM_LIT> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> xaxis5 = XAxis ( <EOL> domain = [ <NUM_LIT> , <NUM_LIT> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> xaxis6 = XAxis ( <EOL> domain = [ <NUM_LIT> , <NUM_LIT:1.0> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> yaxis1 = YAxis ( <EOL> domain = [ <NUM_LIT> , <NUM_LIT:1.0> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> yaxis2 = YAxis ( <EOL> domain = [ <NUM_LIT> , <NUM_LIT:1.0> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> yaxis3 = YAxis ( <EOL> domain = [ <NUM_LIT> , <NUM_LIT:1.0> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> yaxis4 = YAxis ( <EOL> domain = [ <NUM_LIT:0.0> , <NUM_LIT> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> yaxis5 = YAxis ( <EOL> domain = [ <NUM_LIT:0.0> , <NUM_LIT> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) , <EOL> yaxis6 = YAxis ( <EOL> domain = [ <NUM_LIT:0.0> , <NUM_LIT> ] , <EOL> anchor = '<STR_LIT>' <EOL> ) <EOL> ) <EOL> ) <EOL> trace = Scatter ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> fig = tls . make_subplots ( rows = <NUM_LIT:2> , cols = <NUM_LIT:3> ) <EOL> fig . append_trace ( trace , <NUM_LIT:2> , <NUM_LIT:2> ) <EOL> assert fig == expected <EOL> @ raises ( Exception ) <EOL> def test_append_scatter_after_deleting_xaxis ( ) : <EOL> trace = Scatter ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> fig = tls . make_subplots ( rows = <NUM_LIT:2> , cols = <NUM_LIT:3> ) <EOL> fig [ '<STR_LIT>' ] . pop ( '<STR_LIT>' , None ) <EOL> fig . append_trace ( trace , <NUM_LIT:2> , <NUM_LIT:2> ) <EOL> @ raises ( Exception ) <EOL> def test_append_scatter_after_deleting_yaxis ( ) : <EOL> trace = Scatter ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> fig = tls . make_subplots ( rows = <NUM_LIT:2> , cols = <NUM_LIT:3> ) <EOL> fig [ '<STR_LIT>' ] . pop ( '<STR_LIT>' , None ) <EOL> fig . append_trace ( trace , <NUM_LIT:2> , <NUM_LIT:2> ) <EOL> def test_append_scatter3d ( ) : <EOL> expected = Figure ( <EOL> data = Data ( [ <EOL> Scatter3d ( <EOL> x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , <EOL> y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] , <EOL> z = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , <EOL> scene = '<STR_LIT>' <EOL> ) , <EOL> Scatter3d ( <EOL> x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , <EOL> y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] , <EOL> z = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , <EOL> scene = '<STR_LIT>' <EOL> ) <EOL> ] ) , <EOL> layout = Layout ( <EOL> scene1 = Scene ( <EOL> domain = { '<STR_LIT:y>' : [ <NUM_LIT> , <NUM_LIT:1.0> ] , '<STR_LIT:x>' : [ <NUM_LIT:0.0> , <NUM_LIT:1.0> ] } <EOL> ) , <EOL> scene2 = Scene ( <EOL> domain = { '<STR_LIT:y>' : [ <NUM_LIT:0.0> , <NUM_LIT> ] , '<STR_LIT:x>' : [ <NUM_LIT:0.0> , <NUM_LIT:1.0> ] } <EOL> ) <EOL> ) <EOL> ) <EOL> fig = tls . make_subplots ( rows = <NUM_LIT:2> , cols = <NUM_LIT:1> , <EOL> specs = [ [ { '<STR_LIT>' : True } ] , <EOL> [ { '<STR_LIT>' : True } ] ] ) <EOL> trace = Scatter3d ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] , z = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> fig . append_trace ( trace , <NUM_LIT:1> , <NUM_LIT:1> ) <EOL> fig . append_trace ( trace , <NUM_LIT:2> , <NUM_LIT:1> ) <EOL> assert fig == expected <EOL> @ raises ( Exception ) <EOL> def test_append_scatter3d_after_deleting_scene ( ) : <EOL> fig = tls . make_subplots ( rows = <NUM_LIT:2> , cols = <NUM_LIT:1> , <EOL> specs = [ [ { '<STR_LIT>' : True } ] , <EOL> [ { '<STR_LIT>' : True } ] ] ) <EOL> trace = Scatter3d ( x = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] , y = [ <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] , z = [ <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> ] ) <EOL> fig [ '<STR_LIT>' ] . pop ( '<STR_LIT>' , None ) <EOL> fig . append_trace ( trace , <NUM_LIT:1> , <NUM_LIT:1> ) </s>
