Skip to content

Commit d7617d3

Browse files
committed
TST: use python 2.6-compatible testing statements
1 parent 902b386 commit d7617d3

File tree

1 file changed

+18
-15
lines changed

1 file changed

+18
-15
lines changed

pandas/tests/test_rplot.py

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -53,14 +53,14 @@ def test_make_aes1(self):
5353
self.assertTrue(type(aes) is dict)
5454

5555
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'))
6464

6565
def test_dictionary_union(self):
6666
dict1 = {1 : 1, 2 : 2, 3 : 3}
@@ -199,12 +199,12 @@ def test_random_colour(self):
199199
colour = self.colour(self.data, index)
200200
self.assertEqual(len(colour), 3)
201201
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)
208208

209209
class TestScaleConstant(unittest.TestCase):
210210
def test_scale_constant(self):
@@ -226,10 +226,13 @@ def test_scale_size(self):
226226
self.assertTrue(marker in ['o', '+', 's', '*', '^', '<', '>', 'v', '|', 'x'])
227227

228228
def test_scale_overflow(self):
229-
with self.assertRaises(ValueError):
229+
def f():
230230
for index in range(len(self.data)):
231231
self.scale2(self.data, index)
232232

233+
self.assertRaises(ValueError, f)
234+
235+
233236
class TestRPlot(unittest.TestCase):
234237
def test_rplot1(self):
235238
path = os.path.join(curpath(), 'data/tips.csv')

0 commit comments

Comments
 (0)