Commit b8871580 authored by Yori Fournier's avatar Yori Fournier
Browse files

add automation for the tutorials of localhost

parent 165282f8
Pipeline #481 passed with stage
in 4 minutes and 27 seconds
......@@ -15,6 +15,7 @@ myplotlib_import_local_latex_tkagg:
- ./setup_test_folder.sh -r latex-tkagg
- python import_test.py
- python -m tests
- python -m tutorials
- ./clean_test_folder.sh
myplotlib_test_mytool:
......
import unittest
from test_tutorials import TutorialsTestCase
from __init__ import *
verbose = 0
failed = []
states = {}
# List To Line Formatter
suite_tutorials = unittest.TestLoader().loadTestsFromTestCase(TutorialsTestCase)
states.update({'Tutorials': unittest.TextTestRunner(verbosity=verbose).run(suite_tutorials).wasSuccessful()})
for success in states.items():
if not success[1]:
failed.append(success[0])
if len(failed):
raise(Exception('Failing tests suites: '+str(failed)))
#!/usr/bin/env python
import unittest
from tuto000 import script as sc000
from tuto001 import script as sc001
from tuto002 import script as sc002
class TutorialsTestCase(unittest.TestCase):
def setUp(self):
pass
def test_tuto_000(self):
fig = sc000()
fig.plot()
def test_tuto_001(self):
fig = sc001()
fig.plot()
def test_tuto_002(self):
fig = sc002()
fig.plot()
if __name__ == '__main__':
unittest.main()
#!/usr/bin/env python
import sys
sys.path.insert(0, '../')
def script():
from myplotlib import MyData, EmptyFig, EmptyAxes
import sys
sys.path.insert(0, '../')
# read various data
rawdata = MyData(data=[0., 1., 0., 1.])
from myplotlib import MyData, EmptyFig, EmptyAxes
# make a figure
fig = EmptyFig()
# read various data
rawdata = MyData(data=[0., 1., 0., 1.])
# add an empty axes
fig.add_axes(EmptyAxes(fig), "ax1")
fig.set_rawdata((rawdata,))
# make a figure
fig = EmptyFig()
# do some drawing
fig.axes[0].plot(fig.axes[0].data)
# add an empty axes
fig.add_axes(EmptyAxes(fig), "ax1")
fig.set_rawdata((rawdata,))
# print the figure with modif into a file
fig.print2file('./tuto000.png', as_seen=True)
# do some drawing
fig.axes[0].plot(fig.axes[0].data)
return(fig)
if __name__ == '__main__':
# get the figure
fig = script()
# print the figure with modif into a file
fig.print2file('./tuto000.png', as_seen=True)
#!/usr/bin/env python
import sys
sys.path.insert(0, '../')
def script():
from myplotlib import MyData, MyAxes, EmptyFig
import sys
sys.path.insert(0, '../')
class MySuperAxes(MyAxes):
from myplotlib import MyData, MyAxes, EmptyFig
def formatRawData(self, rawdata):
self.data = {'xdata': [rawdata.data[0], rawdata.data[1]],
'ydata': [rawdata.data[2], rawdata.data[3]]}
return(True)
class MySuperAxes(MyAxes):
def plotting(self):
self.plot(self.data['xdata'], self.data['ydata'])
return(True)
def formatRawData(self, rawdata):
self.data = {'xdata': [rawdata.data[0], rawdata.data[1]],
'ydata': [rawdata.data[2], rawdata.data[3]]}
return(True)
# read various data
rawdata = MyData(data=[0., 1., 0., 1.])
def plotting(self):
self.plot(self.data['xdata'], self.data['ydata'])
return(True)
# make a figure
fig = EmptyFig()
# read various data
rawdata = MyData(data=[0., 1., 0., 1.])
# add an empty axes
fig.add_axes(MySuperAxes(fig), "ax1")
fig.set_rawdata((rawdata,))
# make a figure
fig = EmptyFig()
# print the figure with modif into a file
fig.print2file('./tuto001.png')
# add an empty axes
fig.add_axes(MySuperAxes(fig), "ax1")
fig.set_rawdata((rawdata,))
return(fig)
if __name__ == '__main__':
fig = script()
# print the figure with modif into a file
fig.print2file('./tuto001.png')
#!/usr/bin/env python
import sys
sys.path.insert(0, '../')
def script():
from myplotlib import MyData, MyAxes, MyFig
import sys
sys.path.insert(0, '../')
class MySuperAxes(MyAxes):
from myplotlib import MyData, MyAxes, MyFig
def formatRawData(self, rawdata):
self.data = {'xdata': [rawdata.data[0], rawdata.data[1]],
'ydata': [rawdata.data[2], rawdata.data[3]]}
return(True)
class MySuperAxes(MyAxes):
def plotting(self):
self.plot(self.data['xdata'], self.data['ydata'])
return(True)
def formatRawData(self, rawdata):
self.data = {'xdata': [rawdata.data[0], rawdata.data[1]],
'ydata': [rawdata.data[2], rawdata.data[3]]}
return(True)
class MySuperFigure(MyFig):
def plotting(self):
self.plot(self.data['xdata'], self.data['ydata'])
return(True)
def addAxes(self):
self.add_axes(MySuperAxes(self), "ax1")
class MySuperFigure(MyFig):
# read various data
rawdata = MyData(data=[0., 1., 0., 1.])
def addAxes(self):
self.add_axes(MySuperAxes(self), "ax1")
# make a figure
fig = MySuperFigure((rawdata,))
# read various data
rawdata = MyData(data=[0., 1., 0., 1.])
# print the figure with modif into a file
fig.print2file('./tuto002.png')
# make a figure
fig = MySuperFigure((rawdata,))
return(fig)
if __name__ == '__main__':
fig = script()
# print the figure with modif into a file
fig.print2file('./tuto002.png')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment