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
cb1d2e7f
Commit
cb1d2e7f
authored
Jan 23, 2019
by
Yori Fournier
Browse files
Merge branch '_compatible_sml_py3' of gitlab.aip.de:yfournier/myplotlib into _compatible_sml_py3
Conflicts: mpl_fig.py
parents
3242ad3c
f9f74239
Pipeline
#660
failed with stage
in 27 minutes and 17 seconds
Changes
45
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
.configs/tests/config-local.py
View file @
cb1d2e7f
...
@@ -20,7 +20,6 @@ D_FIGNUM = 0 # default figure number
...
@@ -20,7 +20,6 @@ D_FIGNUM = 0 # default figure number
D_FIGSIZE
=
(
8.
,
6.
)
# default figure size
D_FIGSIZE
=
(
8.
,
6.
)
# default figure size
D_REFORMAT
=
True
# default reformat value
D_REFORMAT
=
True
# default reformat value
D_FORMATTED
=
False
# default formatted value
D_FORMATTED
=
False
# default formatted value
D_RAWDATA
=
MplData
()
# default raw data
D_INPUTARG
=
'current'
# default Input argument
D_INPUTARG
=
'current'
# default Input argument
# myIOs
# myIOs
...
...
.gitlab-ci.yml
View file @
cb1d2e7f
before_script
:
before_script
:
-
apt-get update -q -y
-
apt-get update -q -y
-
apt-get install python-dev python-tk -q -y
-
apt-get install python
3 python3
-dev python
3
-tk -q -y
-
wget https://bootstrap.pypa.io/get-pip.py
-
wget https://bootstrap.pypa.io/get-pip.py
-
python get-pip.py
-
python
3
get-pip.py
-
python -m pip --version
-
python
3
-m pip --version
-
python -m pip install --upgrade pip
-
python
3
-m pip install --upgrade pip
-
python -m pip install -U matplotlib
-
python
3
-m pip install -U matplotlib
-
python -m pip install pep8
-
python
3
-m pip install pep8
myplotlib_import_local_latex_tkagg
:
myplotlib_import_local_latex_tkagg
:
script
:
script
:
...
@@ -14,9 +14,9 @@ myplotlib_import_local_latex_tkagg:
...
@@ -14,9 +14,9 @@ myplotlib_import_local_latex_tkagg:
-
ls -l
-
ls -l
-
cd test/localhost
-
cd test/localhost
-
./setup_test_folder.sh -r latex-tkagg
-
./setup_test_folder.sh -r latex-tkagg
-
python import_test.py
-
python
3
import_test.py
-
python -m tests
-
python
3
-m tests
-
python -m tutorials
-
python
3
-m tutorials
-
./clean_test_folder.sh
-
./clean_test_folder.sh
myplotlib_test_mytool
:
myplotlib_test_mytool
:
...
@@ -25,8 +25,8 @@ myplotlib_test_mytool:
...
@@ -25,8 +25,8 @@ myplotlib_test_mytool:
-
ls -l
-
ls -l
-
cd mpl_toolbox/
-
cd mpl_toolbox/
-
cp ../.configs/tests/config-local.py ../config.py
-
cp ../.configs/tests/config-local.py ../config.py
-
python -m tests
-
python
3
-m tests
-
python -m tutorials
-
python
3
-m tutorials
myplotlib_import_network_latex_tkagg
:
myplotlib_import_network_latex_tkagg
:
script
:
script
:
...
@@ -34,8 +34,8 @@ myplotlib_import_network_latex_tkagg:
...
@@ -34,8 +34,8 @@ myplotlib_import_network_latex_tkagg:
-
ls -l
-
ls -l
-
cd test/network
-
cd test/network
-
./setup_test_folder.sh -r latex-tkagg
-
./setup_test_folder.sh -r latex-tkagg
-
python test_com_nogl.py
-
python
3
test_com_nogl.py
-
python -m tests
-
python
3
-m tests
-
./clean_test_folder.sh
-
./clean_test_folder.sh
myplotlib_test_pep8
:
myplotlib_test_pep8
:
...
@@ -43,5 +43,5 @@ myplotlib_test_pep8:
...
@@ -43,5 +43,5 @@ myplotlib_test_pep8:
-
git name-rev --name-only HEAD
-
git name-rev --name-only HEAD
-
ls -l
-
ls -l
-
cd test
-
cd test
-
python -m comp_pep8
-
python
3
-m comp_pep8
allow_failure
:
true
allow_failure
:
true
__init__.py
View file @
cb1d2e7f
...
@@ -87,11 +87,12 @@ else:
...
@@ -87,11 +87,12 @@ else:
raise
ImportError
raise
ImportError
# myplotlib
# myplotlib
from
.mpl_data
import
MplData
#
from .mpl_data import MplData
# CONFIGURATION --------------------------------------------------------
# CONFIGURATION --------------------------------------------------------
from
.config
import
D_FIGNUM
,
D_FIGSIZE
,
D_REFORMAT
,
D_FORMATTED
from
.config
import
D_FIGNUM
,
D_FIGSIZE
,
D_REFORMAT
,
D_FORMATTED
from
.config
import
D_RAWDATA
,
D_INPUTARG
# from .config import D_RAWDATA, D_INPUTARG
from
.config
import
D_INPUTARG
from
.config
import
D_IPATH
from
.config
import
D_IPATH
from
.config
import
D_OPATH
,
D_OFORMAT
from
.config
import
D_OPATH
,
D_OFORMAT
from
.config
import
D_DEBUG
from
.config
import
D_DEBUG
...
...
empty_axes.py
View file @
cb1d2e7f
...
@@ -7,5 +7,5 @@ class EmptyAxes(MplAxes):
...
@@ -7,5 +7,5 @@ class EmptyAxes(MplAxes):
return
(
True
)
return
(
True
)
def
format_rawdata
(
self
,
rawdata
):
def
format_rawdata
(
self
,
rawdata
):
self
.
data
=
rawdata
.
data
self
.
data
=
rawdata
return
(
True
)
return
(
True
)
mpl_axes.py
View file @
cb1d2e7f
...
@@ -227,13 +227,13 @@ class MplAxes(metaclass=AxesClassFactory, context=CONTEXT.lower()):
...
@@ -227,13 +227,13 @@ class MplAxes(metaclass=AxesClassFactory, context=CONTEXT.lower()):
# PLOTTING ---------------------------------------------------------
# PLOTTING ---------------------------------------------------------
def
plotting
(
self
):
def
plotting
(
self
):
raise
(
NotImplementedError
,
'You should have overwrite the'
raise
NotImplementedError
(
'You should have overwrite the'
' plotting function.'
)
' plotting function.'
)
return
(
False
)
return
(
False
)
# FORMATTING -------------------------------------------------------
# FORMATTING -------------------------------------------------------
def
format_rawdata
(
self
,
rawdata
):
def
format_rawdata
(
self
,
rawdata
):
raise
(
NotImplementedError
,
'You should have overwritten the '
raise
NotImplementedError
(
'You should have overwritten the '
'format_rawdata method.'
)
'format_rawdata method.'
)
return
(
False
)
return
(
False
)
...
@@ -241,12 +241,12 @@ class MplAxes(metaclass=AxesClassFactory, context=CONTEXT.lower()):
...
@@ -241,12 +241,12 @@ class MplAxes(metaclass=AxesClassFactory, context=CONTEXT.lower()):
# PARENT CONSTRUCTOR -----------------------------------------------
# PARENT CONSTRUCTOR -----------------------------------------------
def
parent_constructor
(
self
,
fig
,
rect
,
**
kwargs
):
def
parent_constructor
(
self
,
fig
,
rect
,
**
kwargs
):
raise
(
NotImplementedError
,
'You should have overwritten the '
raise
NotImplementedError
(
'You should have overwritten the '
'parent_constructor method.'
)
'parent_constructor method.'
)
# UPDATE -----------------------------------------------------------
# UPDATE -----------------------------------------------------------
def
update
(
self
,
*
args
,
**
kwargs
):
def
update
(
self
,
*
args
,
**
kwargs
):
raise
(
NotImplementedError
,
'You should have overwritten the '
raise
NotImplementedError
(
'You should have overwritten the '
'update method.'
)
'update method.'
)
# --- LOCAL/CLIENT CONTEXT METHODS ---------------------------------
# --- LOCAL/CLIENT CONTEXT METHODS ---------------------------------
...
...
mpl_fig.py
View file @
cb1d2e7f
...
@@ -73,7 +73,7 @@ from . import D_OFORMAT, D_OPATH
...
@@ -73,7 +73,7 @@ from . import D_OFORMAT, D_OPATH
from
.
import
DBUG
,
SEVR
,
INFO
,
SPCE
,
WARN
from
.
import
DBUG
,
SEVR
,
INFO
,
SPCE
,
WARN
from
.
import
CONTEXT
from
.
import
CONTEXT
from
.
import
MplData
#
from . import MplData
from
.
import
MplAxes
from
.
import
MplAxes
from
.
import
HorizontalGrid
from
.
import
HorizontalGrid
...
@@ -578,14 +578,13 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
...
@@ -578,14 +578,13 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
After the rawdata is successfully set, it will be formatted.
After the rawdata is successfully set, it will be formatted.
"""
"""
from
collections
import
Iterable
#from collections import Iterable
from
itertools
import
repeat
self
.
formatted
=
False
self
.
formatted
=
False
status
=
False
status
=
False
# DEFAULT: one item per axes in figure
# DEFAULT: one item per axes in figure
if
isinstance
(
rawdata
,
Iterab
le
):
if
isinstance
(
rawdata
,
tup
le
):
if
len
(
rawdata
)
==
len
(
self
.
get_axes
()):
if
len
(
rawdata
)
==
len
(
self
.
get_axes
()):
if
(
self
.
debug
):
if
(
self
.
debug
):
...
@@ -604,21 +603,12 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
...
@@ -604,21 +603,12 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
len_rawdata
=
len
(
rawdata
)))
len_rawdata
=
len
(
rawdata
)))
return
(
False
)
return
(
False
)
# CONVINIENT: one object for all axes
elif
isinstance
(
rawdata
,
MplData
):
if
(
self
.
debug
):
print
(
"{dbug} set_rawdata: one item for all axes
\
"
.
format
(
dbug
=
DBUG
))
# This is the trick rawdata becomes a generator (so smart)
self
.
rawdata
=
repeat
(
rawdata
)
status
=
self
.
format_rawdata
()
else
:
else
:
print
(
"{sevr} set_rawdata: I could not set the rawdata...
\
print
(
"{sevr} set_rawdata: I could not set the rawdata...
\
"
.
format
(
sevr
=
SEVR
))
"
.
format
(
sevr
=
SEVR
))
self
.
rawdata
=
None
self
.
rawdata
=
None
status
=
False
status
=
False
raise
TypeError
(
'rawdata must be an tuple of the length of the number of axes.'
)
if
not
status
:
if
not
status
:
print
(
"{sevr} set_rawdata: I could not set the rawdata...
\
print
(
"{sevr} set_rawdata: I could not set the rawdata...
\
...
@@ -645,11 +635,10 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
...
@@ -645,11 +635,10 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
if
(
self
.
debug
):
if
(
self
.
debug
):
print
(
"{info} Axes: {axes_class_name}
\
print
(
"{info} Axes: {axes_class_name}
\
with index {index} formats
{
rawdata
_name}
\
with index {index} formats rawdata
\
"
.
format
(
info
=
INFO
,
"
.
format
(
info
=
INFO
,
axes_class_name
=
ax
.
__class__
.
__name__
,
axes_class_name
=
ax
.
__class__
.
__name__
,
index
=
self
.
get_axes
().
index
(
ax
),
index
=
self
.
get_axes
().
index
(
ax
)))
rawdata_name
=
rawdata
.
name
))
status
=
ax
.
test_rawdata
(
rawdata
)
status
=
ax
.
test_rawdata
(
rawdata
)
if
status
:
if
status
:
status
=
ax
.
format_rawdata
(
rawdata
)
status
=
ax
.
format_rawdata
(
rawdata
)
...
@@ -1001,9 +990,6 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
...
@@ -1001,9 +990,6 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
After the rawdata is successfully set, it will be formatted.
After the rawdata is successfully set, it will be formatted.
"""
"""
from
collections
import
Iterable
from
itertools
import
repeat
self
.
formatted
=
False
self
.
formatted
=
False
status
=
False
status
=
False
...
@@ -1020,13 +1006,13 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
...
@@ -1020,13 +1006,13 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
status
=
self
.
format_rawdata
()
status
=
self
.
format_rawdata
()
# DEFAULT: one item per axes in figure
# DEFAULT: one item per axes in figure
el
if
isinstance
(
rawdata
,
Iterab
le
):
if
isinstance
(
rawdata
,
tup
le
):
if
len
(
rawdata
)
==
len
(
self
.
get_axes
()):
if
len
(
rawdata
)
==
len
(
self
.
get_axes
()):
if
(
self
.
debug
):
if
(
self
.
debug
):
print
(
"{dbug} set_rawdata: one item per axes
\
print
(
"{dbug} set_rawdata: one item per axes
\
"
.
format
(
dbug
=
DBUG
))
"
.
format
(
dbug
=
DBUG
))
self
.
rawdata
=
[
self
.
server
.
_rawdata
[
name
]
for
name
in
rawdata
]
self
.
rawdata
=
[
self
.
server
.
_rawdata
[
name
]
for
name
in
rawdata
]
status
=
self
.
format_rawdata
()
status
=
self
.
format_rawdata
()
else
:
else
:
...
@@ -1044,6 +1030,7 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
...
@@ -1044,6 +1030,7 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
"
.
format
(
sevr
=
SEVR
))
"
.
format
(
sevr
=
SEVR
))
self
.
rawdata
=
None
self
.
rawdata
=
None
status
=
False
status
=
False
raise
TypeError
(
'rawdata must be an tuple of the length of the number of axes.'
)
if
not
status
:
if
not
status
:
print
(
"{sevr} set_rawdata: I could not set the rawdata...
\
print
(
"{sevr} set_rawdata: I could not set the rawdata...
\
...
@@ -1051,7 +1038,7 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
...
@@ -1051,7 +1038,7 @@ class MplFig(metaclass=FigureClassFactory, context=CONTEXT.lower()):
self
.
rawdata
=
None
self
.
rawdata
=
None
return
(
status
)
return
(
status
)
_format_rawdata_server
=
_format_rawdata_local
_format_rawdata_server
=
_format_rawdata_local
def
_get_fig_id_server
(
self
):
def
_get_fig_id_server
(
self
):
...
...
mpl_server.py
View file @
cb1d2e7f
...
@@ -11,7 +11,7 @@ from . import SERVER_FIGURES
...
@@ -11,7 +11,7 @@ from . import SERVER_FIGURES
from
.
import
MplFig
from
.
import
MplFig
from
.
import
DBUG
,
WARN
,
SPCE
,
SEVR
,
INFO
from
.
import
DBUG
,
WARN
,
SPCE
,
SEVR
,
INFO
from
.
import
MplUnpickler
,
MplData
from
.
import
MplUnpickler
from
.
import
D_DEBUG
from
.
import
D_DEBUG
...
@@ -78,12 +78,12 @@ class MplHandler(socketserver.StreamRequestHandler):
...
@@ -78,12 +78,12 @@ class MplHandler(socketserver.StreamRequestHandler):
try
:
try
:
for
data_name
in
data_names
:
for
data_name
in
data_names
:
if
self
.
server
.
_rawdata
.
get
(
data_name
,
None
)
is
not
None
:
if
self
.
server
.
_rawdata
.
get
(
data_name
,
None
)
is
not
None
:
merged_data
.
append
(
self
.
server
.
_rawdata
[
data_name
]
.
data
)
merged_data
.
append
(
self
.
server
.
_rawdata
[
data_name
])
else
:
else
:
return
Status
(
False
,
'Could not create '
return
Status
(
False
,
'Could not create '
+
str
(
merged_name
)
+
', '
+
str
(
data_name
)
+
' does not exist...'
)
+
str
(
merged_name
)
+
', '
+
str
(
data_name
)
+
' does not exist...'
)
self
.
server
.
_rawdata
[
merged_name
]
=
MplData
(
data
=
merged_data
,
name
=
merged_name
)
self
.
server
.
_rawdata
[
merged_name
]
=
merged_data
return
Status
(
True
,
'data '
return
Status
(
True
,
'data '
+
str
(
merged_name
)
+
' was successfully created from '
+
str
(
data_names
))
+
str
(
merged_name
)
+
' was successfully created from '
+
str
(
data_names
))
...
@@ -190,7 +190,7 @@ class MplHandler(socketserver.StreamRequestHandler):
...
@@ -190,7 +190,7 @@ class MplHandler(socketserver.StreamRequestHandler):
def
treat_list_data
(
self
,
content
):
def
treat_list_data
(
self
,
content
):
""" list the keys
""" list the keys
(and possibly (later)the location) from _rawdata """
(and possibly (later)the location) from _rawdata """
return
Answer
(
self
.
server
.
_rawdata
.
keys
())
return
Answer
(
list
(
self
.
server
.
_rawdata
.
keys
())
)
def
treat_get_data
(
self
,
content
):
def
treat_get_data
(
self
,
content
):
""" from _figures """
""" from _figures """
...
...
mpl_toolbox/formatter.py
View file @
cb1d2e7f
...
@@ -22,14 +22,14 @@ class FormatterListToLine(Formatter):
...
@@ -22,14 +22,14 @@ class FormatterListToLine(Formatter):
def
shape
(
self
,
rawdata
):
def
shape
(
self
,
rawdata
):
ydata
=
rawdata
.
data
ydata
=
rawdata
xdata
=
range
(
0
,
len
(
ydata
))
xdata
=
list
(
range
(
0
,
len
(
ydata
))
)
data
=
{
'ydatas'
:
[
ydata
],
data
=
{
'ydatas'
:
[
ydata
],
'xdata'
:
xdata
,
'xdata'
:
xdata
,
'xlabel'
:
self
.
xlabel
,
'xlabel'
:
self
.
xlabel
,
'ylabel'
:
self
.
ylabel
,
'ylabel'
:
self
.
ylabel
,
'name'
:
rawdata
.
name
}
}
return
(
data
)
return
(
data
)
...
@@ -46,17 +46,17 @@ class FormatterArrayToLines(Formatter):
...
@@ -46,17 +46,17 @@ class FormatterArrayToLines(Formatter):
def
shape
(
self
,
rawdata
):
def
shape
(
self
,
rawdata
):
if
self
.
xdata_index
is
not
None
:
if
self
.
xdata_index
is
not
None
:
ydatas
=
rawdata
.
data
[:]
ydatas
=
rawdata
[:]
xdata
=
ydatas
.
pop
(
self
.
xdata_index
)
xdata
=
ydatas
.
pop
(
self
.
xdata_index
)
else
:
else
:
ydatas
=
rawdata
.
data
ydatas
=
rawdata
xdata
=
range
(
0
,
len
(
ydatas
[
0
]))
# generic xdata
xdata
=
list
(
range
(
0
,
len
(
ydatas
[
0
]))
)
# generic xdata
data
=
{
'ydatas'
:
ydatas
,
data
=
{
'ydatas'
:
ydatas
,
'xdata'
:
xdata
,
'xdata'
:
xdata
,
'xlabel'
:
self
.
xlabel
,
'xlabel'
:
self
.
xlabel
,
'ylabel'
:
self
.
ylabel
,
'ylabel'
:
self
.
ylabel
,
'name'
:
rawdata
.
name
}
}
return
(
data
)
return
(
data
)
...
@@ -74,16 +74,16 @@ class FormatterAppendToLines(Formatter):
...
@@ -74,16 +74,16 @@ class FormatterAppendToLines(Formatter):
xdata
=
[]
xdata
=
[]
if
self
.
with_label
:
if
self
.
with_label
:
labels
=
rawdata
.
data
[
0
]
labels
=
rawdata
[
0
]
i_index
=
1
i_index
=
1
else
:
else
:
i_index
=
0
i_index
=
0
labels
=
[]
labels
=
[]
for
item
in
rawdata
.
data
[
i_index
]:
for
item
in
rawdata
[
i_index
]:
ydatas
.
append
([
item
])
ydatas
.
append
([
item
])
for
line
in
rawdata
.
data
[
i_index
+
1
:]:
for
line
in
rawdata
[
i_index
+
1
:]:
for
i
in
range
(
0
,
len
(
line
)):
for
i
in
range
(
0
,
len
(
line
)):
ydatas
[
i
].
append
(
line
[
i
])
ydatas
[
i
].
append
(
line
[
i
])
...
@@ -98,14 +98,14 @@ class FormatterAppendToLines(Formatter):
...
@@ -98,14 +98,14 @@ class FormatterAppendToLines(Formatter):
else
:
else
:
labels
=
repeat
(
None
)
labels
=
repeat
(
None
)
else
:
else
:
xdata
=
range
(
0
,
len
(
ydatas
[
0
]))
# generic xdata
xdata
=
list
(
range
(
0
,
len
(
ydatas
[
0
]))
)
# generic xdata
data
=
{
'ydatas'
:
ydatas
,
data
=
{
'ydatas'
:
ydatas
,
'xdata'
:
xdata
,
'xdata'
:
xdata
,
'xlabel'
:
self
.
xlabel
,
'xlabel'
:
self
.
xlabel
,
'ylabel'
:
self
.
ylabel
,
'ylabel'
:
self
.
ylabel
,
'labels'
:
labels
,
'labels'
:
labels
,
'name'
:
rawdata
.
name
}
}
return
(
data
)
return
(
data
)
...
...
mpl_toolbox/tests/__init__.py
View file @
cb1d2e7f
import
unittest
import
unittest
from
test_formatter
import
FormatterListToLineTestCase
from
.
test_formatter
import
FormatterListToLineTestCase
from
test_formatter
import
FormatterArrayToLinesTestCase
from
.
test_formatter
import
FormatterArrayToLinesTestCase
from
test_formatter
import
FormatterAppendToLinesTestCase
from
.
test_formatter
import
FormatterAppendToLinesTestCase
from
test_weighted_grid
import
WeightedGridTestCase
from
.
test_weighted_grid
import
WeightedGridTestCase
mpl_toolbox/tests/__main__.py
View file @
cb1d2e7f
from
__init__
import
*
from
.
__init__
import
*
verbose
=
0
verbose
=
0
failed
=
[]
failed
=
[]
...
...
mpl_toolbox/tests/test_formatter.py
View file @
cb1d2e7f
...
@@ -5,14 +5,13 @@ import unittest
...
@@ -5,14 +5,13 @@ import unittest
sys
.
path
.
append
(
'../../'
)
sys
.
path
.
append
(
'../../'
)
from
myplotlib
import
MplData
from
myplotlib.mpl_toolbox
import
FormatterListToLine
,
FormatterArrayToLines
,
FormatterAppendToLines
from
myplotlib.mpl_toolbox
import
FormatterListToLine
,
FormatterArrayToLines
,
FormatterAppendToLines
class
FormatterListToLineTestCase
(
unittest
.
TestCase
):
class
FormatterListToLineTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
data_line
=
MplData
(
data
=
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
,]
,
self
.
data_line
=
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
,]
name
=
'data_line'
)
def
test_formatter_list_to_line
(
self
):
def
test_formatter_list_to_line
(
self
):
formatter
=
FormatterListToLine
()
formatter
=
FormatterListToLine
()
...
@@ -25,7 +24,7 @@ class FormatterListToLineTestCase(unittest.TestCase):
...
@@ -25,7 +24,7 @@ class FormatterListToLineTestCase(unittest.TestCase):
'xdata'
:
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
,],
'xdata'
:
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
,],
'xlabel'
:
None
,
'xlabel'
:
None
,
'ylabel'
:
None
,
'ylabel'
:
None
,
'name'
:
'data_line'
}
}
self
.
assertEqual
(
data
,
correct_data
)
self
.
assertEqual
(
data
,
correct_data
)
...
@@ -40,17 +39,17 @@ class FormatterListToLineTestCase(unittest.TestCase):
...
@@ -40,17 +39,17 @@ class FormatterListToLineTestCase(unittest.TestCase):
'xdata'
:
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
],
'xdata'
:
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
],
'xlabel'
:
r
'x-axis'
,
'xlabel'
:
r
'x-axis'
,
'ylabel'
:
r
'y-axis'
,
'ylabel'
:
r
'y-axis'
,
'name'
:
'data_line'
}
}
self
.
assertEqual
(
data
,
correct_data
)
self
.
assertEqual
(
data
,
correct_data
)
class
FormatterArrayToLinesTestCase
(
unittest
.
TestCase
):
class
FormatterArrayToLinesTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
data_lines
=
MplData
(
data
=
[[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
],
self
.
data_lines
=
[[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
],
[
0.
,
2.
,
4.
,
6.
,
8.
,
10.
],
[
0.
,
2.
,
4.
,
6.
,
8.
,
10.
],
[
0.
,
3.
,
6.
,
9.
,
12.
,
15.
]]
,
[
0.
,
3.
,
6.
,
9.
,
12.
,
15.
]]
name
=
'data_lines'
)
def
test_formatter_array_to_lines
(
self
):
def
test_formatter_array_to_lines
(
self
):
formatter
=
FormatterArrayToLines
()
formatter
=
FormatterArrayToLines
()
...
@@ -66,7 +65,7 @@ class FormatterArrayToLinesTestCase(unittest.TestCase):
...
@@ -66,7 +65,7 @@ class FormatterArrayToLinesTestCase(unittest.TestCase):
'xdata'
:
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
],
'xdata'
:
[
0.
,
1.
,
2.
,
3.
,
4.
,
5.
],
'xlabel'
:
None
,
'xlabel'
:
None
,
'ylabel'
:
None
,
'ylabel'
:
None
,
'name'
:
'data_lines'
}
}
self
.
assertEqual
(
data
,
correct_data
)
self
.
assertEqual
(
data
,
correct_data
)
...
@@ -83,29 +82,29 @@ class FormatterArrayToLinesTestCase(unittest.TestCase):
...
@@ -83,29 +82,29 @@ class FormatterArrayToLinesTestCase(unittest.TestCase):
'xdata'
:
[
0.
,
2.
,
4.
,
6.
,
8.
,
10.
],
'xdata'
:
[
0.
,
2.
,
4.
,
6.
,
8.
,
10.
],
'xlabel'
:
r
'x-axis'
,
'xlabel'
:
r
'x-axis'
,
'ylabel'
:
r
'y-axis'
,
'ylabel'
:
r
'y-axis'
,
'name'
:
'data_lines'
}
}
self
.
assertEqual
(
data
,
correct_data
)
self
.
assertEqual
(
data
,
correct_data
)
class
FormatterAppendToLinesTestCase
(
unittest
.
TestCase
):
class
FormatterAppendToLinesTestCase
(
unittest
.
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
data_cols
=
MplData
(
data
=
[[
0.
,
0.
,
0.
],
self
.
data_cols
=
[[
0.
,
0.
,
0.
],
[
1.
,
2.
,
3.
],