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

test_add_logo_invalid_size()   A

Complexity

Conditions 2

Size

Total Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
c 1
b 0
f 0
dl 0
loc 5
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
8
import matplotlib.pyplot as plt
9
import pytest
10
11
from metpy.plots import add_logo, add_timestamp
12
13
14
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
15
def test_add_timestamp():
16
    """Test adding a timestamp to an axes object."""
17
    fig = plt.figure(figsize=(9, 9))
18
    ax = plt.subplot(1, 1, 1)
19
    add_timestamp(ax, time=datetime(2017, 1, 1))
20
    return fig
21
22
23
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
24
def test_add_logo_small():
25
    """Test adding a logo to a figure."""
26
    fig = plt.figure(figsize=(9, 9))
27
    add_logo(fig)
28
    return fig
29
30
31
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
32
def test_add_logo_large():
33
    """Test adding a logo to a figure."""
34
    fig = plt.figure(figsize=(9, 9))
35
    add_logo(fig, size='large')
36
    return fig
37
38
39
def test_add_logo_invalid_size():
40
    """Test adding a logo to a figure with an invalid size specification."""
41
    fig = plt.figure(figsize=(9, 9))
42
    with pytest.raises(ValueError):
43
        add_logo(fig, size='jumbo')
44