19
19
from seaborn ._core .moves import Move , Shift , Dodge
20
20
from seaborn ._core .rules import categorical_order
21
21
from seaborn ._core .exceptions import PlotSpecError
22
- from seaborn ._stats .aggregation import Agg
23
22
from seaborn ._marks .base import Mark
24
23
from seaborn ._stats .base import Stat
24
+ from seaborn ._marks .dot import Dot
25
+ from seaborn ._stats .aggregation import Agg
25
26
from seaborn .external .version import Version
26
27
27
28
assert_vector_equal = functools .partial (
@@ -1261,8 +1262,8 @@ def test_scale_setup(self):
1261
1262
msg = "Scale setup failed for the `color` variable."
1262
1263
with pytest .raises (PlotSpecError , match = msg ) as err :
1263
1264
p .plot ()
1264
- assert isinstance (err .__cause__ , ValueError )
1265
- assert bad_palette in str (err .__cause__ )
1265
+ assert isinstance (err . value .__cause__ , ValueError )
1266
+ assert bad_palette in str (err . value .__cause__ )
1266
1267
1267
1268
def test_coordinate_scaling (self ):
1268
1269
@@ -1273,24 +1274,29 @@ def test_coordinate_scaling(self):
1273
1274
msg = "Scaling operation failed for the `x` variable."
1274
1275
with pytest .raises (PlotSpecError , match = msg ) as err :
1275
1276
p .plot ()
1276
- # Don't test the cause contents b/c matplotlib own them here.
1277
- assert hasattr (err , "__cause__" )
1277
+ # Don't test the cause contents b/c matplotlib owns them here.
1278
+ assert hasattr (err . value , "__cause__" )
1278
1279
1279
1280
def test_semantic_scaling (self ):
1280
1281
1281
- class ErrorRaisingScale (Continuous ):
1282
+ class ErrorRaising (Continuous ):
1283
+
1284
+ def _setup (self , data , prop , axis = None ):
1282
1285
1283
- def _setup (self , data , prop , axis ):
1284
1286
def f (x ):
1285
1287
raise ValueError ("This is a test" )
1286
- return f
1288
+
1289
+ new = super ()._setup (data , prop , axis )
1290
+ new ._pipeline = [f ]
1291
+ return new
1287
1292
1288
1293
x = y = color = [1 , 2 ]
1289
- p = Plot (x , y , color = color ).add (MockMark ()).scale (color = ErrorRaisingScale ())
1290
- with pytest .raises (PlotSpecError ) as err :
1294
+ p = Plot (x , y , color = color ).add (Dot ()).scale (color = ErrorRaising ())
1295
+ msg = "Scaling operation failed for the `color` variable."
1296
+ with pytest .raises (PlotSpecError , match = msg ) as err :
1291
1297
p .plot ()
1292
- assert isinstance (err .__cause__ , ValueError )
1293
- assert str (err .__cause__ ) == "This is a test"
1298
+ assert isinstance (err . value .__cause__ , ValueError )
1299
+ assert str (err . value .__cause__ ) == "This is a test"
1294
1300
1295
1301
1296
1302
class TestFacetInterface :
0 commit comments