forked from hughesadam87/python-api
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_lines.py
More file actions
33 lines (28 loc) · 1.33 KB
/
test_lines.py
File metadata and controls
33 lines (28 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import matplotlib.pyplot as plt
from .nose_tools import compare_dict, run_fig
from .data.lines import *
def test_simple_line():
fig, ax = plt.subplots()
ax.plot(D['x1'], D['y1'], label='simple')
renderer = run_fig(fig)
for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
equivalent, msg = compare_dict(data_dict, SIMPLE_LINE['data'][data_no])
assert equivalent, msg
equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
SIMPLE_LINE['layout'])
assert equivalent, msg
def test_complicated_line():
fig, ax = plt.subplots()
ax.plot(D['x1'], D['y1'], 'ro', markersize=10, alpha=.5, label='one')
ax.plot(D['x1'], D['y1'], '-b', linewidth=2, alpha=.7, label='two')
ax.plot(D['x2'], D['y2'], 'b+', markeredgewidth=2,
markersize=10, alpha=.6, label='three')
ax.plot(D['x2'], D['y2'], '--r', linewidth=2, alpha=.8, label='four')
renderer = run_fig(fig)
for data_no, data_dict in enumerate(renderer.plotly_fig['data']):
equivalent, msg = compare_dict(data_dict,
COMPLICATED_LINE['data'][data_no])
assert equivalent, msg
equivalent, msg = compare_dict(renderer.plotly_fig['layout'],
COMPLICATED_LINE['layout'])
assert equivalent, msg