Completed
Pull Request — master (#413)
by
unknown
01:25
created

test_add_logo_small()   A

Complexity

Conditions 1

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
1
# Copyright (c) 2008-2016 MetPy Developers.
2
# Distributed under the terms of the BSD 3-Clause License.
3
# SPDX-License-Identifier: BSD-3-Clause
4
"""Tests for the `_util` module."""
5
6
from datetime import datetime
7
import pytest
8
9
import matplotlib.pyplot as plt
10
from metpy.plots import add_logo, add_timestamp
11
12
13
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
14
def test_add_timestamp():
15
    """Test adding a timestamp to an axes object."""
16
    fig = plt.figure(figsize=(9, 9))
17
    ax = plt.subplot(1, 1, 1)
18
    add_timestamp(ax, time=datetime(2017, 1, 1))
19
    return fig
20
21
22
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
23
def test_add_logo_small():
24
    """Test adding a logo to a figure."""
25
    fig = plt.figure(figsize=(9, 9))
26
    add_logo(fig)
27
    return fig
28
29
30
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
31
def test_add_logo_large():
32
    """Test adding a logo to a figure."""
33
    fig = plt.figure(figsize=(9, 9))
34
    add_logo(fig, size='large')
35
    return fig
36
37
38
def test_add_logo_invalid_size():
39
    """Test adding a logo to a figure with an invalid size specification."""
40
    fig = plt.figure(figsize=(9, 9))
41
    with pytest.raises(ValueError):
42
        add_logo(fig, size='jumbo')
43