Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Yori Fournier
myplotlib
Commits
779620e2
Commit
779620e2
authored
Aug 26, 2017
by
Yori 'AGy' Fournier
Browse files
Add a server test for testing myFig and myAxes
parent
90d1e373
Changes
4
Hide whitespace changes
Inline
Side-by-side
myFig_server.py
View file @
779620e2
...
...
@@ -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.
...
...
test/__init__.py
View file @
779620e2
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
,
]
test/figTestServer.py
0 → 100644
View file @
779620e2
# 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"
)
test/tests_server.py
0 → 100644
View file @
779620e2
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
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment