@@ -53,14 +53,14 @@ def test_make_aes1(self):
53
53
self .assertTrue (type (aes ) is dict )
54
54
55
55
def test_make_aes2 (self ):
56
- with self .assertRaises (ValueError ):
57
- rplot . make_aes ( size = rplot .ScaleShape ('test' ))
58
- with self .assertRaises (ValueError ):
59
- rplot . make_aes ( colour = rplot .ScaleShape ('test' ))
60
- with self .assertRaises (ValueError ):
61
- rplot . make_aes ( shape = rplot .ScaleSize ('test' ))
62
- with self .assertRaises (ValueError ):
63
- rplot . make_aes ( alpha = rplot .ScaleShape ('test' ))
56
+ self .assertRaises (ValueError , rplot . make_aes ,
57
+ size = rplot .ScaleShape ('test' ))
58
+ self .assertRaises (ValueError , rplot . make_aes ,
59
+ colour = rplot .ScaleShape ('test' ))
60
+ self .assertRaises (ValueError , rplot . make_aes ,
61
+ shape = rplot .ScaleSize ('test' ))
62
+ self .assertRaises (ValueError , rplot . make_aes ,
63
+ alpha = rplot .ScaleShape ('test' ))
64
64
65
65
def test_dictionary_union (self ):
66
66
dict1 = {1 : 1 , 2 : 2 , 3 : 3 }
@@ -199,12 +199,12 @@ def test_random_colour(self):
199
199
colour = self .colour (self .data , index )
200
200
self .assertEqual (len (colour ), 3 )
201
201
r , g , b = colour
202
- self .assertGreaterEqual ( r , 0.0 )
203
- self .assertGreaterEqual ( g , 0.0 )
204
- self .assertGreaterEqual ( b , 0.0 )
205
- self .assertLessEqual ( r , 1.0 )
206
- self .assertLessEqual ( g , 1.0 )
207
- self .assertLessEqual ( b , 1.0 )
202
+ self .assertTrue ( r >= 0.0 )
203
+ self .assertTrue ( g >= 0.0 )
204
+ self .assertTrue ( b >= 0.0 )
205
+ self .assertTrue ( r <= 1.0 )
206
+ self .assertTrue ( g <= 1.0 )
207
+ self .assertTrue ( b <= 1.0 )
208
208
209
209
class TestScaleConstant (unittest .TestCase ):
210
210
def test_scale_constant (self ):
@@ -226,10 +226,13 @@ def test_scale_size(self):
226
226
self .assertTrue (marker in ['o' , '+' , 's' , '*' , '^' , '<' , '>' , 'v' , '|' , 'x' ])
227
227
228
228
def test_scale_overflow (self ):
229
- with self . assertRaises ( ValueError ):
229
+ def f ( ):
230
230
for index in range (len (self .data )):
231
231
self .scale2 (self .data , index )
232
232
233
+ self .assertRaises (ValueError , f )
234
+
235
+
233
236
class TestRPlot (unittest .TestCase ):
234
237
def test_rplot1 (self ):
235
238
path = os .path .join (curpath (), 'data/tips.csv' )
0 commit comments