[Python-modules-commits] [python-mplexporter] 32/135: Changed test_plolty.py to test dictionaries from 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 1f19ea69e81eff9a39a4bdf23f18cb4669d5f71b
Author: theengineear <andseier at gmail.com>
Date:   Fri Feb 21 14:15:43 2014 -0800

    Changed test_plolty.py to test dictionaries from PlotlyRenderer.
---
 mplexporter/tests/test_plotly.py | 60 ++++++++++++----------------------------
 1 file changed, 17 insertions(+), 43 deletions(-)

diff --git a/mplexporter/tests/test_plotly.py b/mplexporter/tests/test_plotly.py
index e6f51c3..b447a65 100644
--- a/mplexporter/tests/test_plotly.py
+++ b/mplexporter/tests/test_plotly.py
@@ -5,7 +5,22 @@ import matplotlib
 matplotlib.use('Agg')
 import matplotlib.pyplot as plt
 
-T1 = {
+
+def test_simple_line():
+    fig, ax = plt.subplots()
+    ax.plot(range(10), '-k')
+    ax.plot(range(5), '.k')
+
+    renderer = PlotlyRenderer()
+    exporter = Exporter(renderer)
+    exporter.run(fig)
+    assert SIMPLE_LINE['data'] == renderer.data
+    assert SIMPLE_LINE['layout'] == renderer.layout
+
+
+## dictionaries for tests
+
+SIMPLE_LINE = {
     'data': [
         {'line': {'color': '#000000',
                   'dash': 'solid',
@@ -45,45 +60,4 @@ T1 = {
                          'title': ''
                }
     }
-}
-
-T2_OUTPUT = """
-opening figure
-  opening axis 1
-    draw line with 20 points
-  closing axis 1
-  opening axis 2
-    draw 10 markers
-  closing axis 2
-closing figure
-"""
-
-
-def test_1():
-    fig, ax = plt.subplots()
-    ax.plot(range(10), '-k')
-    ax.plot(range(5), '.k')
-    # plt.title('test1')
-
-    renderer = PlotlyRenderer()
-    exporter = Exporter(renderer)
-    exporter.run(fig)
-    assert T1['data'] == renderer.data
-    assert T1['layout'] == renderer.layout
-
-
-def test_2():
-    plt.figure(1)
-    plt.subplot(211)
-    plt.plot(range(20), '-k')
-    plt.subplot(212)
-    plt.plot(range(10), '.k')
-    fig = plt.gcf()
-
-    renderer = PlotlyRenderer()
-    exporter = Exporter(renderer)
-    exporter.run(fig)
-
-    for line1, line2 in zip(renderer.output.strip().split(),
-                            T2_OUTPUT.strip().split()):
-        assert line1 == line2
\ No newline at end of file
+}
\ No newline at end of file

-- 
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