#NEWLINE# def testBasic( self ) : #NEWLINE# #INDENT# 'A basic test of MplSubStyle.' #NEWLINE# figVals = { #NEWLINE# #INDENT# 'figwidth' : 10 , #NEWLINE# 'figheight' : 10 , #NEWLINE# 'dpi' : 100 , #NEWLINE# #UNINDENT# } #NEWLINE# axVals = { #NEWLINE# #INDENT# 'axisbelow' : True , #NEWLINE# 'frame_on' : False , #NEWLINE# #UNINDENT# } #NEWLINE# patchVals = { #NEWLINE# #INDENT# 'alpha' : 0.95 , #NEWLINE# 'visible' : False , #NEWLINE# 'facecolor' : ( 1.0 , 0.0 , 0.0 , 0.95 ) , #NEWLINE# 'edgecolor' : ( 1.0 , 0.0 , 0.0 , 0.95 ) , #NEWLINE# 'linestyle' : 'dashdot' , #NEWLINE# 'linewidth' : 2.5 , #NEWLINE# #UNINDENT# } #NEWLINE# fig = mpl . figure . Figure ( ) #NEWLINE# ax = mpl . axes . Axes ( fig , [ 0.2 , 0.2 , 0.6 , 0.6 ] ) #NEWLINE# element = mpl . patches . Patch ( ) #NEWLINE# style = MplSubStyle ( figure = { #NEWLINE# #INDENT# 'width' : figVals [ 'figwidth' ] , #NEWLINE# 'height' : figVals [ 'figheight' ] , #NEWLINE# 'dpi' : figVals [ 'dpi' ] , #NEWLINE# #UNINDENT# } , axes = { #NEWLINE# #INDENT# 'axisBelow' : axVals [ 'axisbelow' ] , #NEWLINE# 'showFrame' : axVals [ 'frame_on' ] , #NEWLINE# #UNINDENT# } , patch = { #NEWLINE# #INDENT# 'alpha' : patchVals [ 'alpha' ] , #NEWLINE# 'visible' : patchVals [ 'visible' ] , #NEWLINE# 'color' : patchVals [ 'facecolor' ] , #NEWLINE# 'edgeColor' : patchVals [ 'edgecolor' ] , #NEWLINE# 'edgeStyle' : patchVals [ 'linestyle' ] , #NEWLINE# 'edgeWidth' : patchVals [ 'linewidth' ] , #NEWLINE# #UNINDENT# } ) #NEWLINE# style . apply ( fig ) #NEWLINE# self . checkElement ( 'Apply Figure' , figVals , fig ) #NEWLINE# style . apply ( ax ) #NEWLINE# self . checkElement ( 'Apply Axes' , axVals , ax ) #NEWLINE# style . apply ( element ) #NEWLINE# self . checkElement ( 'Apply Patch' , patchVals , element ) #NEWLINE# self . assertRaises ( Exception , style . apply , 'invalid' , msg = 'Failed to throw on invalid element.' )