8000 updated grid_test to decrease collision for random file_name and · modulexcite/plotly.py@16950fc · GitHub
[go: up one dir, main page]

Skip to content

Commit 16950fc

Browse files
committed
updated grid_test to decrease collision for random file_name and
replaced PlotlyRequestError with requests.exceptions.HTTPError
1 parent 16a6a3c commit 16950fc

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

plotly/tests/test_core/test_grid/test_grid.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
import random
1111
import string
12+
import requests
1213

1314
from nose import with_setup
1415
from nose.tools import raises
@@ -22,8 +23,9 @@
2223

2324

2425
def random_filename():
25-
random_chars = [random.choice(string.ascii_uppercase) for _ in range(5)]
26-
unique_filename = 'Valid Grid '+''.join(random_chars)
26+
choice_chars = string.ascii_letters + string.digits
27+
random_chars = [random.choice(choice_chars) for _ in range(10)]
28+
unique_filename = 'Valid Grid ' + ''.join(random_chars)
2729
return unique_filename
2830

2931

@@ -139,15 +141,15 @@ def test_scatter_from_non_uploaded_grid():
139141
Scatter(xsrc=g[0], ysrc=g[1])
140142

141143

142-
@raises(PlotlyRequestError)
144+
@raises(requests.exceptions.HTTPError)
143145
def test_column_append_of_non_uploaded_grid():
144146
c1 = Column([1, 2, 3, 4], 'first column')
145147
c2 = Column(['a', 'b', 'c', 'd'], 'second column')
146148
g = Grid([c1])
147149
py.grid_ops.append_columns([c2], grid=g)
148150

149151

150-
@raises(PlotlyRequestError)
152+
@raises(requests.exceptions.HTTPError)
151153
def test_row_append_of_non_uploaded_grid():
152154
c1 = Column([1, 2, 3, 4], 'first column')
153155
rows = [[1], [2]]
@@ -189,7 +191,7 @@ def test_duplicate_filenames():
189191
g = Grid([c1])
190192

191193
random_chars = [random.choice(string.ascii_uppercase) for _ in range(5)]
192-
unique_filename = 'Valid Grid '+''.join(random_chars)
194+
unique_filename = 'Valid Grid ' + ''.join(random_chars)
193195
py.grid_ops.upload(g, unique_filename, auto_open=False)
194196
try:
195197
py.grid_ops.upload(g, unique_filename, auto_open=False)

0 commit comments

Comments
 (0)
0