Completed
Pull Request — master (#413)
by
unknown
01:42
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
8
import matplotlib.pyplot as plt
9
from metpy.plots import add_logo, add_timestamp
10
import pytest
11
12
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
13
def test_add_timestamp():
14
    """Test adding a timestamp to an axes object."""
15
    fig = plt.figure(figsize=(9, 9))
16
    ax = plt.subplot(1, 1, 1)
17
    add_timestamp(ax, time=datetime(2017,1,1))
18
    return fig
19
20
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
21
def test_add_logo_small():
22
    """Test adding a logo to a figure."""
23
    fig = plt.figure(figsize=(9, 9))
24
    add_logo(fig)
25
    return fig
26
27
@pytest.mark.mpl_image_compare(tolerance=0.021, remove_text=True)
28
def test_add_logo_large():
29
    """Test adding a logo to a figure."""
30
    fig = plt.figure(figsize=(9, 9))
31
    add_logo(fig, size='large')
32
    return fig
33
34
def test_add_logo_invalid_size():
35
    """Test adding a logo to a figure with an invalid size specification."""
36
    fig = plt.figure(figsize=(9, 9))
37
    with pytest.raises(ValueError):
38
        add_logo(fig, size='jumbo')
39