Skip to content

Commit bb20d36

Browse files
committed
test fix
1 parent 68e4e8e commit bb20d36

File tree

4 files changed

+27
-23
lines changed

4 files changed

+27
-23
lines changed

test/test_annotate.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,8 @@ def plot():
3939
def test():
4040
phash = Phash(plot())
4141
assert phash.phash == 'ab8a79a1549654be', phash.get_details()
42+
43+
44+
if __name__ == '__main__':
45+
plot()
46+
plt.show()

test/test_basic_sin.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,11 @@
22
#
33
from helpers import Phash
44

5-
from matplotlib import pyplot as plt
6-
from matplotlib import style
7-
import numpy as np
8-
95

106
def plot():
7+
from matplotlib import pyplot as plt
8+
import numpy as np
9+
1110
fig = plt.figure()
1211
with plt.style.context(('ggplot')):
1312
t = np.arange(0.0, 2.0, 0.1)

test/test_image_plot.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,52 @@
11
# -*- coding: utf-8 -*-
22
#
33
import helpers
4-
from matplotlib import rcParams
5-
from matplotlib import pyplot as pp
64
import pytest
7-
import os
8-
9-
try:
10-
from PIL import Image
11-
except ImportError:
12-
raise RuntimeError('PIL must be installed to run this example')
135

146
# the picture 'lena.png' with origin='lower' is flipped upside-down.
157
# So it has to be upside-down in the pdf-file as well.
168

179

1810
# test for monochrome picture
1911
def plot1():
12+
from matplotlib import rcParams
13+
import matplotlib.pyplot as plt
14+
from PIL import Image
15+
import os
2016

2117
this_dir = os.path.dirname(os.path.realpath(__file__))
2218
lena = Image.open(os.path.join(this_dir, 'lena.png'))
2319
lena = lena.convert('L')
2420
dpi = rcParams['figure.dpi']
2521
figsize = lena.size[0]/dpi, lena.size[1]/dpi
26-
fig = pp.figure(figsize=figsize)
27-
ax = pp.axes([0, 0, 1, 1], frameon=False)
22+
fig = plt.figure(figsize=figsize)
23+
ax = plt.axes([0, 0, 1, 1], frameon=False)
2824
ax.set_axis_off()
29-
pp.imshow(lena, cmap='viridis', origin='lower')
25+
plt.imshow(lena, cmap='viridis', origin='lower')
3026
# Set the current color map to HSV.
31-
pp.hsv()
32-
pp.colorbar()
27+
plt.hsv()
28+
plt.colorbar()
3329
return fig
3430

3531

3632
# test for rgb picture
3733
def plot2():
34+
from matplotlib import rcParams
35+
import matplotlib.pyplot as plt
36+
from PIL import Image
37+
import os
3838

3939
this_dir = os.path.dirname(os.path.realpath(__file__))
4040
lena = Image.open(os.path.join(this_dir, 'lena.png'))
4141
dpi = rcParams['figure.dpi']
4242
figsize = lena.size[0] / dpi, lena.size[1] / dpi
43-
fig = pp.figure(figsize=figsize)
44-
ax = pp.axes([0, 0, 1, 1], frameon=False)
43+
fig = plt.figure(figsize=figsize)
44+
ax = plt.axes([0, 0, 1, 1], frameon=False)
4545
ax.set_axis_off()
46-
pp.imshow(lena, cmap='viridis', origin='lower')
46+
plt.imshow(lena, cmap='viridis', origin='lower')
4747
# Set the current color map to HSV.
48-
pp.hsv()
49-
pp.colorbar()
48+
plt.hsv()
49+
plt.colorbar()
5050
return fig
5151

5252

test/test_scatter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55

66
def plot():
77
from matplotlib import pyplot as plt
8-
from matplotlib import style
98
import numpy as np
9+
1010
fig = plt.figure()
1111
with plt.style.context(('fivethirtyeight')):
1212
np.random.seed(123)

0 commit comments

Comments
 (0)