[Python-modules-commits] [python-mplexporter] 31/135: Initial testing for plotly. Dictionary comparisons for PlotlyRenderer.

Wolfgang Borgert debacle at moszumanska.debian.org
Tue Sep 23 21:19:00 UTC 2014


This is an automated email from the git hooks/post-receive script.

debacle pushed a commit to branch master
in repository python-mplexporter.

commit f4724ce3da2c09c1fd1e2102a0468aa1d116106e
Author: theengineear <andseier at gmail.com>
Date:   Fri Feb 21 13:47:30 2014 -0800

    Initial testing for plotly. Dictionary comparisons for PlotlyRenderer.
---
 mplexporter/tests/test_plotly.py | 63 +++++++++++++++++++++++++++++-----------
 1 file changed, 46 insertions(+), 17 deletions(-)

diff --git a/mplexporter/tests/test_plotly.py b/mplexporter/tests/test_plotly.py
index c8c694d..e6f51c3 100644
--- a/mplexporter/tests/test_plotly.py
+++ b/mplexporter/tests/test_plotly.py
@@ -5,15 +5,47 @@ import matplotlib
 matplotlib.use('Agg')
 import matplotlib.pyplot as plt
 
-
-T1_OUTPUT = """
-opening figure
-  opening axis 1
-    draw line with 20 points
-    draw 10 markers
-  closing axis 1
-closing figure
-"""
+T1 = {
+    'data': [
+        {'line': {'color': '#000000',
+                  'dash': 'solid',
+                  'opacity': 1,
+                  'width': 1.0
+                  },
+         'mode': 'lines',
+         'x': [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0],
+         'xaxis': 'x',
+         'y': [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0],
+         'yaxis': 'y'
+         },
+        {'marker': {'color': '#000000',
+                    'line': {'color': '#000000',
+                             'width': 0.5
+                             },
+                    'opacity': 1,
+                    'symbol': 'dot'
+                    },
+         'mode': 'markers',
+         'x': [0.0, 1.0, 2.0, 3.0, 4.0],
+         'xaxis': 'x',
+         'y': [0.0, 1.0, 2.0, 3.0, 4.0],
+         'yaxis': 'y'}
+    ],
+    'layout': {'height': 480,
+               'showlegend': False,
+               'title': '',
+               'width': 640,
+               'xaxis': {'range': (0.0, 9.0),
+                         'showgrid': False,
+                         'title': ''
+               },
+               'yaxis': {'domain': [0, 1],
+                         'range': (0.0, 9.0),
+                         'showgrid': False,
+                         'title': ''
+               }
+    }
+}
 
 T2_OUTPUT = """
 opening figure
@@ -29,16 +61,15 @@ closing figure
 
 def test_1():
     fig, ax = plt.subplots()
-    ax.plot(range(20), '-k')
-    ax.plot(range(10), '.k')
+    ax.plot(range(10), '-k')
+    ax.plot(range(5), '.k')
+    # plt.title('test1')
 
     renderer = PlotlyRenderer()
     exporter = Exporter(renderer)
     exporter.run(fig)
-
-    for line1, line2 in zip(renderer.output.strip().split(),
-                            T1_OUTPUT.strip().split()):
-        assert line1 == line2
+    assert T1['data'] == renderer.data
+    assert T1['layout'] == renderer.layout
 
 
 def test_2():
@@ -52,8 +83,6 @@ def test_2():
     renderer = PlotlyRenderer()
     exporter = Exporter(renderer)
     exporter.run(fig)
-    plt.show()
-    print renderer.output
 
     for line1, line2 in zip(renderer.output.strip().split(),
                             T2_OUTPUT.strip().split()):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/python-modules/packages/python-mplexporter.git



More information about the Python-modules-commits mailing list