File: test_miscplot.py

package info (click to toggle)
seaborn 0.12.2-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 6,148 kB
  • sloc: python: 36,560; makefile: 183; javascript: 45; sh: 15
file content (34 lines) | stat: -rw-r--r-- 914 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import matplotlib.pyplot as plt

from seaborn import miscplot as misc
from seaborn.palettes import color_palette
from .test_utils import _network


class TestPalPlot:
    """Test the function that visualizes a color palette."""
    def test_palplot_size(self):

        pal4 = color_palette("husl", 4)
        misc.palplot(pal4)
        size4 = plt.gcf().get_size_inches()
        assert tuple(size4) == (4, 1)

        pal5 = color_palette("husl", 5)
        misc.palplot(pal5)
        size5 = plt.gcf().get_size_inches()
        assert tuple(size5) == (5, 1)

        palbig = color_palette("husl", 3)
        misc.palplot(palbig, 2)
        sizebig = plt.gcf().get_size_inches()
        assert tuple(sizebig) == (6, 2)


class TestDogPlot:

    @_network(url="https://github.com/mwaskom/seaborn-data")
    def test_dogplot(self):
        misc.dogplot()
        ax = plt.gca()
        assert len(ax.images) == 1