@@ -501,64 +501,65 @@ def test_removed_axis():
501
501
axs [0 ].remove ()
502
502
fig .canvas .draw ()
503
503
504
- @check_figures_equal ()
505
- @pytest .mark .parametrize ('x' , [
506
- [["A" , "A" , "B" ], ["C" , "D" , "B" ]],
507
- [[1 , 1 , 2 ], [3 , 4 , 2 ]]]
508
- )
509
- def test_collage_basic (fig_test , fig_ref , x ):
510
- grid_axes = fig_test .build_grid (x )
511
504
512
- for k , ax in grid_axes .items ():
513
- ax .set_title (k )
505
+ class TestCollage :
506
+ @check_figures_equal ()
507
+ @pytest .mark .parametrize ('x' , [
508
+ [["A" , "A" , "B" ], ["C" , "D" , "B" ]],
509
+ [[1 , 1 , 2 ], [3 , 4 , 2 ]]]
510
+ )
511
+ def test_basic (self , fig_test , fig_ref , x ):
512
+ grid_axes = fig_test .build_grid (x )
514
513
515
- labels = sorted (np .unique (x ))
514
+ for k , ax in grid_axes .items ():
515
+ ax .set_title (k )
516
516
517
- assert len ( labels ) == len ( grid_axes )
517
+ labels = sorted ( np . unique ( x ) )
518
518
519
- gs = fig_ref .add_gridspec (2 , 3 )
520
- axA = fig_ref .add_subplot (gs [:1 , :2 ])
521
- axA .set_title (labels [0 ])
519
+ assert len (labels ) == len (grid_axes )
522
520
523
- axB = fig_ref .add_subplot (gs [:, 2 ])
524
- axB .set_title (labels [1 ])
521
+ gs = fig_ref .add_gridspec (2 , 3 )
522
+ axA = fig_ref .add_subplot (gs [:1 , :2 ])
523
+ axA .set_title (labels [0 ])
525
524
526
- axC = fig_ref .add_subplot (gs [1 , 0 ])
527
- axC .set_title (labels [2 ])
525
+ axB = fig_ref .add_subplot (gs [:, 2 ])
526
+ axB .set_title (labels [1 ])
528
527
529
- axD = fig_ref .add_subplot (gs [1 , 1 ])
530
- axD .set_title (labels [3 ])
528
+ axC = fig_ref .add_subplot (gs [1 , 0 ])
529
+ axC .set_title (labels [2 ])
531
530
531
+ axD = fig_ref .add_subplot (gs [1 , 1 ])
532
+ axD .set_title (labels [3 ])
532
533
533
- @check_figures_equal (tol = 0.005 )
534
- def test_collage_nested ( fig_test , fig_ref ):
535
- x = [["A" , "B" , "B" ], ["C" , "C" , "D" ]]
534
+ @check_figures_equal (tol = 0.005 )
535
+ def test_nested ( self , fig_test , fig_ref ):
536
+ x = [["A" , "B" , "B" ], ["C" , "C" , "D" ]]
536
537
537
- y = [["F" ], [x ]]
538
+ y = [["F" ], [x ]]
538
539
539
- grid_axes = fig_test .build_grid (y )
540
+ grid_axes = fig_test .build_grid (y )
540
541
541
- for k , ax in grid_axes .items ():
542
- ax .set_title (k )
542
+ for k , ax in grid_axes .items ():
543
+ ax .set_title (k )
543
544
544
- gs = fig_ref .add_gridspec (2 , 1 )
545
+ gs = fig_ref .add_gridspec (2 , 1 )
545
546
546
- gs_n = gs [1 , 0 ].subgridspec (2 , 3 )
547
+ gs_n = gs [1 , 0 ].subgridspec (2 , 3 )
547
548
548
- axA = fig_ref .add_subplot (gs_n [0 , 0 ])
549
- axA .set_title ("A" )
549
+ axA = fig_ref .add_subplot (gs_n [0 , 0 ])
550
+ axA .set_title ("A" )
550
551
551
- axB = fig_ref .add_subplot (gs_n [0 , 1 :])
552
- axB .set_title ("B" )
552
+ axB = fig_ref .add_subplot (gs_n [0 , 1 :])
553
+ axB .set_title ("B" )
553
554
554
- axC = fig_ref .add_subplot (gs_n [1 , :2 ])
555
- axC .set_title ("C" )
555
+ axC = fig_ref .add_subplot (gs_n [1 , :2 ])
556
+ axC .set_title ("C" )
556
557
557
- axD = fig_ref .add_subplot (gs_n [1 , 2 ])
558
- axD .set_title ("D" )
558
+ axD = fig_ref .add_subplot (gs_n [1 , 2 ])
559
+ axD .set_title ("D" )
559
560
560
- axF = fig_ref .add_subplot (gs [0 , 0 ])
561
- axF .set_title ("F" )
561
+ axF = fig_ref .add_subplot (gs [0 , 0 ])
562
+ axF .set_title ("F" )
562
563
563
- fig_test .tight_layout ()
564
- fig_ref .tight_layout ()
564
+ fig_test .tight_layout ()
565
+ fig_ref .tight_layout ()
0 commit comments