Code Duplication    Length = 21-22 lines in 2 locations

metpy/plots/tests/test_skewt.py 2 locations

@@ 15-36 (lines=22) @@
12
from metpy.units import units
13
14
15
@pytest.mark.mpl_image_compare
16
def test_skewt_api():
17
    'Test the SkewT api'
18
    with style.context(test_style):
19
        fig = make_figure(figsize=(9, 9))
20
        skew = SkewT(fig)
21
22
        # Plot the data using normal plotting functions, in this case using
23
        # log scaling in Y, as dictated by the typical meteorological plot
24
        p = np.linspace(1000, 100, 10)
25
        t = np.linspace(20, -20, 10)
26
        u = np.linspace(-10, 10, 10)
27
        skew.plot(p, t, 'r')
28
        skew.plot_barbs(p, u, u)
29
30
        # Add the relevant special lines
31
        skew.plot_dry_adiabats()
32
        skew.plot_moist_adiabats()
33
        skew.plot_mixing_lines()
34
        hide_tick_labels(skew.ax)
35
36
        return fig
37
38
39
@pytest.mark.mpl_image_compare(savefig_kwargs={'bbox_inches': 'tight'})
@@ 39-59 (lines=21) @@
36
        return fig
37
38
39
@pytest.mark.mpl_image_compare(savefig_kwargs={'bbox_inches': 'tight'})
40
def test_skewt_size():
41
    'Test that figure sizes are not inflated by ticks (#158)'
42
    with style.context(test_style):
43
        fig = make_figure(figsize=(9, 9))
44
        skew = SkewT(fig)
45
46
        # Plot the data using normal plotting functions, in this case using
47
        # log scaling in Y, as dictated by the typical meteorological plot
48
        p = np.linspace(1000, 100, 10)
49
        t = np.linspace(20, -20, 10)
50
        u = np.linspace(-10, 10, 10)
51
        skew.plot(p, t, 'r')
52
        skew.plot_barbs(p, u, u)
53
54
        # Add the relevant special lines
55
        skew.plot_dry_adiabats()
56
        skew.plot_moist_adiabats()
57
        skew.plot_mixing_lines()
58
59
        return fig
60
61
62
@pytest.mark.mpl_image_compare