@@ -463,9 +463,69 @@ def test_dendrogram_orientation_two(self):
463
463
'rgb(245,245,245)' ] # white smoke
464
464
465
465
dendro = tls .FigureFactory .create_dendrogram (X , colorscale = greyscale )
466
- self .assertEqual (dendro ["data" ][0 ]['marker' ]['color' ],
467
- 'rgb(128,128,128)' )
468
- self .assertEqual (dendro ["data" ][1 ]['marker' ]['color' ],
469
- 'rgb(128,128,128)' )
470
- self .assertEqual (dendro ["data" ][2 ]['marker' ]['color' ],
471
- 'rgb(0,0,0)' )
466
+
467
+ expected_dendro = go .Figure (
468
+ data = go .Data ([
469
+ go .Scatter (
470
+ x = np .array ([25. , 25. , 35. , 35. ]),
471
+ y = np .array ([0. , 1. , 1. , 0. ]),
472
+ marker = go .Marker (color = 'rgb(128,128,128)' ),
473
+ mode = 'lines' ,
474
+ xaxis = 'x' ,
475
+ yaxis = 'y'
476
+ ),
477
+ go .Scatter (
478
+ x = np .array ([15. , 15. , 30. , 30. ]),
479
+ y = np .array ([0. , 2.23606798 , 2.23606798 , 1. ]),
480
+ marker = go .Marker (color = 'rgb(128,128,128)' ),
481
+ mode = 'lines' ,
482
+ xaxis = 'x' ,
483
+ yaxis = 'y'
484
+ ),
485
+ go .Scatter (
486
+ x = np .array ([5. , 5. , 22.5 , 22.5 ]),
487
+ y = np .array ([0. , 3.60555128 , 3.60555128 , 2.23606798 ]),
488
+ marker = go .Marker (color = 'rgb(0,0,0)' ),
489
+ mode = 'lines' ,
490
+ xaxis = 'x' ,
491
+ yaxis = 'y'
492
+ )
493
+ ]),
494
+ layout = go .Layout (
495
+ autosize = False ,
496
+ height = '100%' ,
497
+ hovermode = 'closest' ,
498
+ showlegend = False ,
499
+ width = '100%' ,
500
+ xaxis = go .XAxis (
501
+ mirror = 'allticks' ,
502
+ rangemode = 'tozero' ,
503
+ showgrid = False ,
504
+ showline = True ,
505
+ showticklabels = True ,
506
+ tickmode = 'array' ,
507
+ ticks = 'outside' ,
508
+ ticktext = np .array (['3' , '2' , '0' , '1' ]),
509
+ tickvals = [5.0 , 15.0 , 25.0 , 35.0 ],
510
+ type = 'linear' ,
511
+ zeroline = False
512
+ ),
513
+ yaxis = go .YAxis (
514
+ mirror = 'allticks' ,
515
+ rangemode = 'tozero' ,
516
+ showgrid = False ,
517
+ showline = True ,
518
+ showticklabels = True ,
519
+ ticks = 'outside' ,
520
+ type = 'linear' ,
521
+ zeroline = False
522
+ )
523
+ )
524
+ )
525
+
526
+ self .assertEqual (len (dendro ['data' ]), 3 )
527
+
528
+ # this is actually a bit clearer when debugging tests.
529
+ self .assert_dict_equal (dendro ['data' ][0 ], expected_dendro ['data' ][0 ])
530
+ self .assert_dict_equal (dendro ['data' ][1 ], expected_dendro ['data' ][1 ])
531
+ self .assert_dict_equal (dendro ['data' ][2 ], expected_dendro ['data' ][2 ])
0 commit comments