Commit fc1939d0 authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

tests for myAxes done! see test201, test202

parent e1ff7d08
......@@ -132,14 +132,14 @@ from .test import myTest
# import the tests
from .test import test100
from .test import test200
from .test import test200, test201, test202
from .test import test300, test301, test302, test303, test304, test305, test306
from .test import test400, test401, test402, test403
from .test import test600
# the tests to run
testList = [test100,
test200,
test200, test201, test202,
test300, test301, test302, test303, test304, test305,
test306,
test400, test401, test402,
......
......@@ -96,7 +96,7 @@ class MyAxes(Axes):
# PLOTTING -----------------------------------------------------------
# the plotting function (need to be overwrite from child
def plotting(self):
try:
try:
self.plot(self.data['xdata'], self.data['ydata'])
except KeyError:
print(SEVR + 'The formatting of the data was apparently wrong. --> EXIT')
......
from . import os
from . import D_OFORMAT, D_OPATH
from . import rcParams
from . import readStupidData, readStupidData2
from . import MyFig, MyWin
from . import MyData, MyAxes, MyFig, MyWin
from . import SEVR, WARN, DBUG, SPCE
from . import _G_WINDOWS
from . import G_RAWDATAS, _G_WINDOWS
# TESTER
......@@ -31,17 +32,17 @@ def myTest(function, expected, failed, debug):
return(True)
# TEST 1.* for testing MyData
# TEST 2.* for testing MyAxes
# TEST 3.* for testing MyFig
# TEST 4.* for testing MyWin
# TEST 5.* for testing myTool
# TEST 1.00: test the Data Structure (EXPECTED: TRUE)
def test100(debug):
from . import MyData
data = MyData()
if data.name == 'default':
......@@ -63,11 +64,6 @@ def test100(debug):
#
def test200(debug):
# local import
from . import MyData, MyFig, MyAxes
from . import rcParams
# set some global variable for the test
rcParams['font.size'] = 22
MyFig.FIGSIZE = (8., 6.)
......@@ -151,7 +147,64 @@ def test200(debug):
return(status)
# TEST 300: test the update of inputarg (EXPECTED: TRUE)
# TEST 2.01: Testing the function formatRawData
def test201(debug):
# add some empty data in G_RAWDATAS
G_RAWDATAS.update({'data': MyData()})
# create the environment
fig = MyFig(inputarg='data')
# create the axis
ax = MyAxes(fig, 6. / 8., [0, 0, 1, 1])
# Set the data (emulate some myIO function)
G_RAWDATAS['data'].data = [-1, 1, 1, -1]
# formatRawData
ax.formatRawData(G_RAWDATAS['data'])
# test if results compatible with inputs.
if(ax.data['xdata'] == [-1, 1] and ax.data['ydata'] == [1, -1]):
status = True
else:
status = False
return(status)
# TEST 2.02: Testing the function plotting
def test202(debug):
# create the environment
fig = MyFig()
# create the axis
ax = MyAxes(fig, 6. / 8., [0, 0, 1, 1])
# set the data (simulate some formatRawData function)
ax.data = {'xdata': [-1, 1], 'ydata': [1, -1]}
# plotting
ax.plotting()
# debug
if(debug):
print(DBUG + "the test on _x return: " + str((ax.lines[0]._x == [-1, 1]).all()))
print(SPCE + "the test on _y return: " + str((ax.lines[0]._y == [1, -1]).all()))
print(SPCE + "the -AND test returns: " + str((ax.lines[0]._x == [-1, 1]).all() and (ax.lines[0]._y == [1, -1]).all()))
# and test
if((ax.lines[0]._x == [-1, 1]).all() and (ax.lines[0]._y == [1, -1]).all()):
status = True
else:
status = False
return(status)
# TEST 3.00: test the update of inputarg (EXPECTED: TRUE)
def test300(debug):
status = True
......
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