Skip to content

Commit b62c91f

Browse files
spruce up tests a tad
1 parent 13675fb commit b62c91f

File tree

5 files changed

+18
-30
lines changed

5 files changed

+18
-30
lines changed
83.6 KB
Loading
90.5 KB
Loading
-83.4 KB
Binary file not shown.

examples/mpftests/test_addplot.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,36 @@
88
print("plt.rcParams['backend'] =",plt.rcParams['backend']) # for the record
99

1010
import subprocess
11-
result = subprocess.run(['pwd'], stdout=subprocess.PIPE)
12-
print('result.stdout=',result.stdout)
11+
pwd = subprocess.run(['pwd'], stdout=subprocess.PIPE)
12+
print('pwd.stdout=',pwd.stdout)
1313

1414

1515
df = pd.read_csv('../data/SPY_20110701_20120630_Bollinger.csv',index_col=0,parse_dates=True)
1616
print('df.shape=' , df.shape )
1717
print('df.head(3)=', df.head(3))
1818
print('df.tail(3)=', df.tail(3))
1919

20+
prefix='addplot'
21+
tdir='test_images/'
22+
refd='reference_images/'
23+
os.system('rm -f '+tdir+prefix+'*.jpg')
24+
os.system('rm -f '+tdir+prefix+'*.png')
2025

21-
mpf.plot(df,volume=True,savefig='test01.jpg')
26+
# ---- Test 01 -----
2227

23-
os.system('ls -l test01.jpg')
28+
fname=prefix+'01.jpg'
29+
mpf.plot(df,volume=True,savefig=tdir+fname)
2430

25-
rc = os.system('diff test01.jpg reference_images/test01.jpg')
31+
os.system('ls -l '+tdir+fname)
32+
rc = os.system('diff '+tdir+fname+' '+refd+fname)
2633
assert rc == 0
2734

35+
# ---- Test 02 -----
36+
37+
fname=prefix+'02.jpg'
2838
apdict = mpf.make_addplot(df['LowerB'])
29-
mpf.plot(df,volume=True,addplot=apdict,savefig='test02.jpg')
39+
mpf.plot(df,volume=True,addplot=apdict,savefig=tdir+fname)
3040

31-
os.system('ls -l test02.jpg')
32-
rc = os.system('diff test02.jpg reference_images/test02.jpg')
41+
os.system('ls -l '+tdir+fname)
42+
rc = os.system('diff '+tdir+fname+' '+refd+fname)
3343
assert rc == 0

examples/mpftests/tmp.py

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)