Skip to content

Commit 6436539

Browse files
fix typo in feature_request template
1 parent 1119898 commit 6436539

File tree

3 files changed

+71
-25
lines changed

3 files changed

+71
-25
lines changed

.github/ISSUE_TEMPLATE/feature_request.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: Feature request
33
about: Suggest an idea for this project
4-
title: 'Feature Reuest:'
4+
title: 'Feature Request:'
55
labels: 'enhancement'
66
assignees: ''
77

tests/test_addplot.py

Lines changed: 61 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,69 @@
1-
import os as os
1+
import os
2+
import os.path
3+
import glob
24
import mplfinance as mpf
35
import matplotlib.pyplot as plt
46
from matplotlib.testing.compare import compare_images
57

68
print('mpf.__version__ =',mpf.__version__) # for the record
79
print("plt.rcParams['backend'] =",plt.rcParams['backend']) # for the record
810

9-
prefix='addplot'
10-
tdir='tests/test_images/'
11-
refd='tests/reference_images/'
12-
os.system('rm -f '+tdir+prefix+'*.png')
11+
base='addplot'
12+
tdir = os.path.join('tests','test_images')
13+
refd = os.path.join('tests','reference_images')
14+
15+
globpattern = os.path.join(tdir,base+'*.png')
16+
oldtestfiles = glob.glob(globpattern)
17+
18+
for fn in oldtestfiles:
19+
try:
20+
os.remove(fn)
21+
except:
22+
print('Error removing file "'+fn+'"')
1323

1424
IMGCOMP_TOLERANCE = 7.0
1525

1626
def test_addplot01(bolldata):
1727

1828
df = bolldata
1929

20-
fname=prefix+'01.png'
21-
mpf.plot(df,volume=True,savefig=tdir+fname)
30+
fname = base+'01.png'
31+
tname = os.path.join(tdir,fname)
32+
rname = os.path.join(refd,fname)
33+
34+
mpf.plot(df,volume=True,savefig=tname)
35+
36+
tsize = os.path.getsize(tname)
37+
print(glob.glob(tname),'[',tsize,'bytes',']')
2238

23-
os.system('ls -l '+tdir+fname)
39+
rsize = os.path.getsize(rname)
40+
print(glob.glob(rname),'[',rsize,'bytes',']')
2441

25-
result = compare_images(refd+fname,tdir+fname,tol=IMGCOMP_TOLERANCE)
42+
result = compare_images(rname,tname,tol=IMGCOMP_TOLERANCE)
2643
if result is not None:
2744
print('result=',result)
2845
assert result is None
2946

3047
def test_addplot02(bolldata):
3148
df = bolldata
32-
fname=prefix+'02.png'
49+
50+
fname = base+'02.png'
51+
tname = os.path.join(tdir,fname)
52+
rname = os.path.join(refd,fname)
53+
3354
apdict = mpf.make_addplot(df['LowerB'])
34-
mpf.plot(df,volume=True,addplot=apdict,savefig=tdir+fname)
55+
mpf.plot(df,volume=True,addplot=apdict,savefig=tname)
56+
57+
tsize = os.path.getsize(tname)
58+
print(glob.glob(tname),'[',tsize,'bytes',']')
3559

36-
os.system('ls -l '+tdir+fname)
60+
rsize = os.path.getsize(rname)
61+
print(glob.glob(rname),'[',rsize,'bytes',']')
3762

38-
result = compare_images(refd+fname,tdir+fname,tol=IMGCOMP_TOLERANCE)
63+
result = compare_images(rname,tname,tol=IMGCOMP_TOLERANCE)
3964
if result is not None:
4065
print('result=',result)
66+
assert result is None
4167

4268
def percentB_aboveone(percentB,price):
4369
import numpy as np
@@ -65,7 +91,10 @@ def percentB_belowzero(percentB,price):
6591

6692
def test_addplot03(bolldata):
6793
df = bolldata
68-
fname=prefix+'03.png'
94+
95+
fname = base+'03.png'
96+
tname = os.path.join(tdir,fname)
97+
rname = os.path.join(refd,fname)
6998

7099
tcdf = df[['LowerB','UpperB']] # DataFrame with two columns
71100

@@ -78,18 +107,25 @@ def test_addplot03(bolldata):
78107
mpf.make_addplot((df['PercentB']),panel='lower',color='g')
79108
]
80109

81-
mpf.plot(df,addplot=apds,figscale=1.3,volume=True,savefig=tdir+fname)
110+
mpf.plot(df,addplot=apds,figscale=1.3,volume=True,savefig=tname)
111+
112+
tsize = os.path.getsize(tname)
113+
print(glob.glob(tname),'[',tsize,'bytes',']')
82114

83-
os.system('ls -l '+tdir+fname)
115+
rsize = os.path.getsize(rname)
116+
print(glob.glob(rname),'[',rsize,'bytes',']')
84117

85-
result = compare_images(refd+fname,tdir+fname,tol=IMGCOMP_TOLERANCE)
118+
result = compare_images(rname,tname,tol=IMGCOMP_TOLERANCE)
86119
if result is not None:
87120
print('result=',result)
88121
assert result is None
89122

90123
def test_addplot04(bolldata):
91124
df = bolldata
92-
fname=prefix+'04.png'
125+
126+
fname = base+'04.png'
127+
tname = os.path.join(tdir,fname)
128+
rname = os.path.join(refd,fname)
93129

94130
tcdf = df[['LowerB','UpperB']] # DataFrame with two columns
95131

@@ -103,11 +139,15 @@ def test_addplot04(bolldata):
103139
]
104140

105141
mpf.plot(df,addplot=apds,figscale=1.5,volume=True,
106-
style='starsandstripes',savefig=tdir+fname)
142+
style='starsandstripes',savefig=tname)
143+
144+
tsize = os.path.getsize(tname)
145+
print(glob.glob(tname),'[',tsize,'bytes',']')
107146

108-
os.system('ls -l '+tdir+fname)
147+
rsize = os.path.getsize(rname)
148+
print(glob.glob(rname),'[',rsize,'bytes',']')
109149

110-
result = compare_images(refd+fname,tdir+fname,tol=IMGCOMP_TOLERANCE)
150+
result = compare_images(rname,tname,tol=IMGCOMP_TOLERANCE)
111151
if result is not None:
112152
print('result=',result)
113153
assert result is None

tests/test_original_flavor.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
import glob
22
import os
3+
import os.path
34
import subprocess
45

56
def test_original_flavor_e2e_examples():
67
"""Run e2e tests for folder"""
78

8-
os.chdir("examples/original_flavor")
9-
exs = glob.glob('*.py')
9+
# os.path.join makes this work on windows as well as linux
10+
new_dir = os.path.join('examples','original_flavor')
11+
orig_dir = os.path.join('..','..')
12+
13+
os.chdir(new_dir)
14+
15+
exs = glob.glob('*.py')
1016
try:
1117
for ex in exs:
1218
subprocess.check_call(["python", ex])
1319
finally:
14-
os.chdir("../../")
20+
os.chdir(orig_dir)

0 commit comments

Comments
 (0)