<s> """<STR_LIT>""" <EOL> import warnings <EOL> from graphy import pie_chart <EOL> from graphy import graphy_test <EOL> class SegmentTest ( graphy_test . GraphyTest ) : <EOL> def setUp ( self ) : <EOL> warnings . resetwarnings ( ) <EOL> def testSegmentOrder ( self ) : <EOL> warnings . filterwarnings ( '<STR_LIT:error>' ) <EOL> self . assertRaises ( DeprecationWarning , pie_chart . Segment , <NUM_LIT:1> , <EOL> '<STR_LIT>' , '<STR_LIT:label>' ) <EOL> s = pie_chart . Segment ( <NUM_LIT:1> , '<STR_LIT:label>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT:label>' , s . label ) <EOL> self . assertEqual ( '<STR_LIT>' , s . color ) <EOL> class PieChartTest ( graphy_test . GraphyTest ) : <EOL> def tearDown ( self ) : <EOL> warnings . resetwarnings ( ) <EOL> def testNegativeSegmentSizes ( self ) : <EOL> self . assertRaises ( AssertionError , pie_chart . PieChart , <EOL> [ - <NUM_LIT:5> , <NUM_LIT:10> ] , [ '<STR_LIT>' , '<STR_LIT>' ] ) <EOL> chart = pie_chart . PieChart ( ) <EOL> self . assertRaises ( AssertionError , pie_chart . Segment , - <NUM_LIT:5> , '<STR_LIT>' , '<STR_LIT>' ) <EOL> segment = chart . AddSegment ( <NUM_LIT:10> , label = '<STR_LIT>' , color = '<STR_LIT>' ) <EOL> self . assertRaises ( AssertionError , segment . _SetSize , - <NUM_LIT:5> ) <EOL> def testAddSegmentOrder ( self ) : <EOL> chart = pie_chart . PieChart ( ) <EOL> warnings . filterwarnings ( '<STR_LIT:error>' ) <EOL> self . assertRaises ( DeprecationWarning , chart . AddSegment , <NUM_LIT:1> , <EOL> '<STR_LIT>' , '<STR_LIT:label>' ) <EOL> chart . AddSegment ( <NUM_LIT:1> , '<STR_LIT:label>' , '<STR_LIT>' ) <EOL> self . assertEqual ( '<STR_LIT:label>' , chart . data [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] . label ) <EOL> self . assertEqual ( '<STR_LIT>' , chart . data [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] . color ) <EOL> def testAddSegmentsOrder ( self ) : <EOL> chart = pie_chart . PieChart ( ) <EOL> warnings . filterwarnings ( '<STR_LIT:error>' ) <EOL> self . assertRaises ( DeprecationWarning , chart . AddSegments , [ <NUM_LIT:1> ] , <EOL> [ '<STR_LIT>' ] , [ '<STR_LIT:label>' ] ) <EOL> warnings . filterwarnings ( '<STR_LIT:ignore>' ) <EOL> chart . AddSegments ( [ <NUM_LIT:1> ] , [ '<STR_LIT:label>' ] , [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( '<STR_LIT:label>' , chart . data [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] . label ) <EOL> self . assertEqual ( '<STR_LIT>' , chart . data [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] . color ) <EOL> def testAddPie ( self ) : <EOL> chart = pie_chart . PieChart ( ) <EOL> i = chart . AddPie ( [ <NUM_LIT:1> ] , [ '<STR_LIT:A>' ] , [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( i , <NUM_LIT:0> ) <EOL> self . assertEqual ( len ( chart . data ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( len ( chart . data [ <NUM_LIT:0> ] ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( chart . data [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] . size , <NUM_LIT:1> ) <EOL> i = chart . AddPie ( [ <NUM_LIT:2> ] , [ '<STR_LIT:B>' ] , [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( i , <NUM_LIT:1> ) <EOL> self . assertEqual ( len ( chart . data ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( len ( chart . data [ <NUM_LIT:0> ] ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( chart . data [ <NUM_LIT:0> ] [ <NUM_LIT:0> ] . size , <NUM_LIT:1> ) <EOL> self . assertEqual ( len ( chart . data [ <NUM_LIT:1> ] ) , <NUM_LIT:1> ) <EOL> self . assertEqual ( chart . data [ <NUM_LIT:1> ] [ <NUM_LIT:0> ] . size , <NUM_LIT:2> ) <EOL> def testAddSegmentToPie ( self ) : <EOL> chart = pie_chart . PieChart ( ) <EOL> chart . AddPie ( [ <NUM_LIT:1> ] , [ '<STR_LIT:A>' ] , [ '<STR_LIT>' ] ) <EOL> chart . AddPie ( [ <NUM_LIT:2> ] , [ '<STR_LIT:B>' ] , [ '<STR_LIT>' ] ) <EOL> chart . AddSegment ( [ <NUM_LIT:10> ] , [ '<STR_LIT>' ] ) <EOL> self . assertEqual ( len ( chart . data [ <NUM_LIT:0> ] ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( len ( chart . data [ <NUM_LIT:1> ] ) , <NUM_LIT:1> ) <EOL> chart . AddSegment ( [ <NUM_LIT:20> ] , [ '<STR_LIT>' ] , pie_index = <NUM_LIT:1> ) <EOL> self . assertEqual ( len ( chart . data [ <NUM_LIT:0> ] ) , <NUM_LIT:2> ) <EOL> self . assertEqual ( len ( chart . data [ <NUM_LIT:1> ] ) , <NUM_LIT:2> ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> graphy_test . main ( ) </s>
