Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bfbc83e

Browse files
committed
Quiver Test
1 parent e77ca80 commit bfbc83e

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed

plotly/tests/test_core/test_tools/test_Quiver.py

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,38 @@
22
from plotly.graph_objs import *
33
import plotly.tools as tls
44
from nose.tools import raises
5+
import numpy as np
6+
7+
8+
@raises(Exception)
9+
def unequal_xy_length():
10+
data = tls.Quiver(x=[1, 2], y=[1], u=[1, 2], v=[1, 2])
11+
12+
13+
@raises(Exception)
14+
def unequal_uv_length():
15+
data = tls.Quiver(x=[1, 2], y=[1, 3], u=[1], v=[1, 2])
16+
17+
18+
@raises(Exception)
19+
def test_wrong_kwarg():
20+
data = tls.Quiver(stuff='not gonna work')
21+
22+
23+
def test_one_arrow():
24+
trace1 = Scatter(
25+
x=np.array([0., 1., np.nan]),
26+
y=np.array([0., 1., np.nan]),
27+
mode='lines',
28+
name='Barb',
29+
line=Line(color='rgb(114, 132, 314)', width=1)
30+
)
31+
trace2 = Scatter(
32+
x=np.array([0.82069826, 1, 0.61548617, np.nan]),
33+
y=np.array([0.61548617, 1, 0.82069826, np.nan]),
34+
mode='lines',
35+
name='Arrow',
36+
line=Line(color='rgb(114, 132, 314)', width=1)
37+
)
38+
expected = Data([trace1, trace2])
39+
assert tls.Quiver(x=[0], y=[0], u=[1], v=[1], scale=1)) == expected

0 commit comments

Comments
 (0)