Commit 779620e2 authored by Yori 'AGy' Fournier's avatar Yori 'AGy' Fournier
Browse files

Add a server test for testing myFig and myAxes

parent 90d1e373
......@@ -194,8 +194,8 @@ class MyFig_server(object):
# GET AXES BY NAME -------------------------------------------------
def getAxesByName(self, name):
for ax in self.get_axes() : # SAME NEED TO CODE GET_AXES
if ax.name == name :
for ax in self.get_axes():
if ax.name == name:
return ax
#if the name is correct we should never get here.
......
from .. import D_HIERARCHY
from .myIOs import readStupidData, readStupidData2
from .axTest1 import AxTest1
from .axTest1 import AxTestPlot2D, AxTestPlots2D
from .figTest import FigTest1, FigTest2
from .tests import myTest
# import the tests
from .tests import test100
from .tests import test200, test201, test202, test203, test204
from .tests import test300, test301, test302, test303, test304, test305
from .tests import test306, test307, test308, test309, test310, test311
from .tests import test312
from .tests import test400, test401, test402, test403
from .tests import test500, test501, test502, test503, test504
from .tests import test505, test506, test507, test508, test509
from .tests import test510, test511
from .tests import test600
# the tests to run
testList = [test100,
test201, test202, test203, test204,
test300, test301, test302, test303, test304, test305,
test306, test307, test308, test309, test310, test311,
test312,
test400, test401, test402,
test503, test506, test500, test507, test501, test502,
test504, test505, test508, test509, test510, test511,
test600,
]
# for the demos
from ..mytool import print2screen
if D_HIERARCHY in ('CLIENT', 'client', 'local', 'LOCAL'):
from .axTest1 import AxTest1
from .axTest1 import AxTestPlot2D, AxTestPlots2D
from .figTest import FigTest1, FigTest2
from .tests import myTest
# import the tests
from .tests import test100
from .tests import test200, test201, test202, test203, test204
from .tests import test300, test301, test302, test303, test304, test305
from .tests import test306, test307, test308, test309, test310, test311
from .tests import test312
from .tests import test400, test401, test402, test403
from .tests import test500, test501, test502, test503, test504
from .tests import test505, test506, test507, test508, test509
from .tests import test510, test511
from .tests import test600
# the tests to run
testList = [test100,
test201, test202, test203, test204,
test300, test301, test302, test303, test304, test305,
test306, test307, test308, test309, test310, test311,
test312,
test400, test401, test402,
test503, test506, test500, test507, test501, test502,
test504, test505, test508, test509, test510, test511,
test600,
]
# for the demos
from ..mytool import print2screen
else:
from .axTestServer import AxTestServer
from .figTestServer import FigTestServer
from .tests_server import myTest
from .tests_server import test100
testList = [test100,
]
# IMPORT ---------------------------------------------------------------
from .. import D_HIERARCHY
from .. import SEVR, DBUG, INFO
if D_HIERARCHY in ('SERVER', 'server'):
print(INFO+"Testing the server.")
else:
print(SEVR+"This is atest for the server, the imports are not correct.")
raise ImportError
from .. import MyFig
from . import AxTestServer
class FigTestServer(MyFig):
FIGSIZE = (8., 6.)
def addAxes(self):
ratio = 6. / 8. # height/width of the axes (in inch)
frame1 = [0.1, 0.1, 0.8, 0.8] # part of the fig that is available
self.add_axes(AxTestServer(self, ratio, frame1), "p1")
from .. import os
from .. import D_OFORMAT, D_OPATH
from .. import MyData
from .. import SEVR, WARN, DBUG, SPCE
from . import FigTestServer
from . import AxTestServer
# TESTER
def myTest(function, expected, failed, debug):
if debug:
status = function(debug)
if status is not expected:
failed.append(str(function.__name__))
return(False)
else:
return(True)
else:
try:
status = function(debug)
if status is not expected:
failed.append(str(function.__name__))
return(False)
else:
return(True)
except:
print(WARN + str(function.__name__) + " caught exception.")
failed.append(str(function.__name__))
return(False)
return(True)
# TEST 1.* for testing MyFig_server
# TEST 2.* for testing MyAxes_server
# TEST 1.00:
def test100(debug):
status = True
mydata = MyData()
mydata.data = [1, 2, 3, 4]
myfig = FigTestServer((mydata,))
if myfig.axes[0].data.get('xdata', None) is None:
status = False
return(status)
Markdown is supported
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