@@ -29,6 +29,10 @@ class TestUtilityFunctions(unittest.TestCase):
29
29
"""
30
30
Tests for RPlot utility functions.
31
31
"""
32
+ def setUp (self ):
33
+ path = os .path .join (curpath (), 'data/iris.csv' )
34
+ self .data = read_csv (path , sep = ',' )
35
+
32
36
def test_make_aes1 (self ):
33
37
aes = rplot .make_aes ()
34
38
self .assertTrue (aes ['x' ] is None )
@@ -74,6 +78,19 @@ def test_merge_aes(self):
74
78
if key != 'size' and key != 'shape' :
75
79
self .assertTrue (layer2 .aes [key ] is None )
76
80
81
+ def test_sequence_layers (self ):
82
+ layer1 = rplot .Layer (self .data )
83
+ layer2 = rplot .GeomPoint (x = 'SepalLength' , y = 'SepalWidth' , size = rplot .ScaleSize ('PetalLength' ))
84
+ layer3 = rplot .GeomPolyFit (2 )
85
+ result = rplot .sequence_layers ([layer1 , layer2 , layer3 ])
86
+ self .assertEqual (len (result ), 3 )
87
+ last = result [- 1 ]
88
+ self .assertEqual (last .aes ['x' ], 'SepalLength' )
89
+ self .assertEqual (last .aes ['y' ], 'SepalWidth' )
90
+ self .assertTrue (isinstance (last .aes ['size' ], rplot .ScaleSize ))
91
+ self .assertTrue (self .data is last .data )
92
+ self .assertTrue (rplot .sequence_layers ([layer1 ])[0 ] is layer1 )
93
+
77
94
class TestScaleGradient (unittest .TestCase ):
78
95
def setUp (self ):
79
96
path = os .path .join (curpath (), 'data/iris.csv' )
0 commit comments