(distance, rotate)
| 6889 | @pytest.mark.parametrize('distance', [0.6, 1.1]) |
| 6890 | @pytest.mark.parametrize('rotate', [False, True]) |
| 6891 | def test_pie_label_auto_align(distance, rotate): |
| 6892 | fig, ax = plt.subplots() |
| 6893 | pie = ax.pie([1, 1], startangle=45) |
| 6894 | |
| 6895 | texts = ax.pie_label( |
| 6896 | pie, ['spam', 'eggs'], distance=distance, rotate=rotate, alignment='auto') |
| 6897 | |
| 6898 | if distance < 1: |
| 6899 | for text in texts: |
| 6900 | # labels within the pie should be centered |
| 6901 | assert text.get_horizontalalignment() == 'center' |
| 6902 | assert text.get_verticalalignment() == 'center' |
| 6903 | |
| 6904 | else: |
| 6905 | # labels outside the pie should be aligned away from it |
| 6906 | h_expected = ['right', 'left'] |
| 6907 | v_expected = ['bottom', 'top'] |
| 6908 | for text, h_align, v_align in zip(texts, h_expected, v_expected): |
| 6909 | assert text.get_horizontalalignment() == h_align |
| 6910 | if rotate: |
| 6911 | assert text.get_verticalalignment() == v_align |
| 6912 | else: |
| 6913 | assert text.get_verticalalignment() == 'center' |
| 6914 | |
| 6915 | |
| 6916 | def test_pie_label_fail(): |
nothing calls this directly
no test coverage detected
searching dependent graphs…