| 64 | |
| 65 | |
| 66 | def test_sankey2(): |
| 67 | s = Sankey(flows=[0.25, -0.25, 0.5, -0.5], labels=['Foo'], |
| 68 | orientations=[-1], unit='Bar') |
| 69 | sf = s.finish() |
| 70 | assert_array_equal(sf[0].flows, [0.25, -0.25, 0.5, -0.5]) |
| 71 | assert sf[0].angles == [1, 3, 1, 3] |
| 72 | assert all([text.get_text()[0:3] == 'Foo' for text in sf[0].texts]) |
| 73 | assert all([text.get_text()[-3:] == 'Bar' for text in sf[0].texts]) |
| 74 | assert sf[0].text.get_text() == '' |
| 75 | assert_allclose(sf[0].tips, |
| 76 | [(-1.375, -0.52011255), |
| 77 | (1.375, -0.75506044), |
| 78 | (-0.75, -0.41522509), |
| 79 | (0.75, -0.8599479)]) |
| 80 | |
| 81 | s = Sankey(flows=[0.25, -0.25, 0, 0.5, -0.5], labels=['Foo'], |
| 82 | orientations=[-1], unit='Bar') |
| 83 | sf = s.finish() |
| 84 | assert_array_equal(sf[0].flows, [0.25, -0.25, 0, 0.5, -0.5]) |
| 85 | assert sf[0].angles == [1, 3, None, 1, 3] |
| 86 | assert_allclose(sf[0].tips, |
| 87 | [(-1.375, -0.52011255), |
| 88 | (1.375, -0.75506044), |
| 89 | (0, 0), |
| 90 | (-0.75, -0.41522509), |
| 91 | (0.75, -0.8599479)]) |
| 92 | |
| 93 | |
| 94 | @check_figures_equal() |