Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2dcc395

Browse files
committed
MAINT moved test_colorbar to pytest
1 parent 24b8122 commit 2dcc395

1 file changed

Lines changed: 8 additions & 19 deletions

File tree

lib/matplotlib/tests/test_colorbar.py

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,12 @@
11
from __future__ import (absolute_import, division, print_function,
22
unicode_literals)
33

4-
import six
5-
64
import numpy as np
7-
from numpy import ma
8-
import matplotlib
95
from matplotlib import rc_context
106
from matplotlib.testing.decorators import image_comparison, cleanup
117
import matplotlib.pyplot as plt
12-
from matplotlib import rcParams
138
from matplotlib.colors import BoundaryNorm, LogNorm
149
from matplotlib.cm import get_cmap
15-
from matplotlib import cm
1610
from matplotlib.colorbar import ColorbarBase
1711

1812

@@ -91,10 +85,10 @@ def _colorbar_extension_length(spacing):
9185
cax.get_xticklines() + cax.get_yticklines():
9286
item.set_visible(False)
9387
# Generate the colorbar.
94-
cb = ColorbarBase(cax, cmap=cmap, norm=norm,
95-
boundaries=boundaries, values=values,
96-
extend=extension_type, extendfrac=extendfrac,
97-
orientation='horizontal', spacing=spacing)
88+
ColorbarBase(cax, cmap=cmap, norm=norm,
89+
boundaries=boundaries, values=values,
90+
extend=extension_type, extendfrac=extendfrac,
91+
orientation='horizontal', spacing=spacing)
9892
# Return the figure to the caller.
9993
return fig
10094

@@ -106,8 +100,8 @@ def _colorbar_extension_length(spacing):
106100
def test_colorbar_extension_shape():
107101
'''Test rectangular colorbar extensions.'''
108102
# Create figures for uniform and proportionally spaced colorbars.
109-
fig1 = _colorbar_extension_shape('uniform')
110-
fig2 = _colorbar_extension_shape('proportional')
103+
_colorbar_extension_shape('uniform')
104+
_colorbar_extension_shape('proportional')
111105

112106

113107
@image_comparison(baseline_images=['colorbar_extensions_uniform',
@@ -116,8 +110,8 @@ def test_colorbar_extension_shape():
116110
def test_colorbar_extension_length():
117111
'''Test variable length colorbar extensions.'''
118112
# Create figures for uniform and proportionally spaced colorbars.
119-
fig1 = _colorbar_extension_length('uniform')
120-
fig2 = _colorbar_extension_length('proportional')
113+
_colorbar_extension_length('uniform')
114+
_colorbar_extension_length('proportional')
121115

122116

123117
@image_comparison(baseline_images=['cbar_with_orientation',
@@ -332,8 +326,3 @@ def test_colorbar_lognorm_extension():
332326
cb = ColorbarBase(ax, norm=LogNorm(vmin=0.1, vmax=1000.0),
333327
orientation='vertical', extend='both')
334328
assert cb._values[0] >= 0.0
335-
336-
337-
if __name__ == '__main__':
338-
import nose
339-
nose.runmodule(argv=['-s', '--with-doctest'], exit=False)

0 commit comments

Comments
 (0)