|
9 | 9 |
|
10 | 10 | import random
|
11 | 11 | import string
|
| 12 | +import requests |
12 | 13 |
|
13 | 14 | from nose import with_setup
|
14 | 15 | from nose.tools import raises
|
|
22 | 23 |
|
23 | 24 |
|
24 | 25 | 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) |
27 | 29 | return unique_filename
|
28 | 30 |
|
29 | 31 |
|
@@ -139,15 +141,15 @@ def test_scatter_from_non_uploaded_grid():
|
139 | 141 | Scatter(xsrc=g[0], ysrc=g[1])
|
140 | 142 |
|
141 | 143 |
|
142 |
| -@raises(PlotlyRequestError) |
| 144 | +@raises(requests.exceptions.HTTPError) |
143 | 145 | def test_column_append_of_non_uploaded_grid():
|
144 | 146 | c1 = Column([1, 2, 3, 4], 'first column')
|
145 | 147 | c2 = Column(['a', 'b', 'c', 'd'], 'second column')
|
146 | 148 | g = Grid([c1])
|
147 | 149 | py.grid_ops.append_columns([c2], grid=g)
|
148 | 150 |
|
149 | 151 |
|
150 |
| -@raises(PlotlyRequestError) |
| 152 | +@raises(requests.exceptions.HTTPError) |
151 | 153 | def test_row_append_of_non_uploaded_grid():
|
152 | 154 | c1 = Column([1, 2, 3, 4], 'first column')
|
153 | 155 | rows = [[1], [2]]
|
@@ -189,7 +191,7 @@ def test_duplicate_filenames():
|
189 | 191 | g = Grid([c1])
|
190 | 192 |
|
191 | 193 | 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) |
193 | 195 | py.grid_ops.upload(g, unique_filename, auto_open=False)
|
194 | 196 | try:
|
195 | 197 | py.grid_ops.upload(g, unique_filename, auto_open=False)
|
|
0 commit comments