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

Skip to content

Commit adbd900

Browse files
committed
update gantt tests
1 parent 6e4cd17 commit adbd900

File tree

1 file changed

+65
-53
lines changed

1 file changed

+65
-53
lines changed

plotly/tests/test_optional/test_figure_factory.py

Lines changed: 65 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1273,59 +1273,71 @@ def test_df_dataframe_all_args(self):
12731273

12741274
test_gantt_chart = ff.create_gantt(df)
12751275

1276-
exp_gantt_chart = {
1277-
'data': [{'marker': {'color': 'white'},
1278-
'name': '',
1279-
'x': ['2009-01-01', '2009-02-30'],
1280-
'y': [0, 0]}],
1281-
'layout': {'height': 600,
1282-
'hovermode': 'closest',
1283-
'shapes': [{'opacity': 1,
1284-
'y1': 0.2,
1285-
'xref': 'x',
1286-
'fillcolor': 'rgb(31, 119, 180)',
1287-
'yref': 'y',
1288-
'y0': -0.2,
1289-
'x0': '2009-01-01',
1290-
'x1': '2009-02-30',
1291-
'type': 'rect',
1292-
'line': {'width': 0}},
1293-
{'opacity': 1,
1294-
'y1': 1.2,
1295-
'xref': 'x',
1296-
'fillcolor': 'rgb(255, 127, 14)',
1297-
'yref': 'y',
1298-
'y0': 0.8,
1299-
'x0': '2009-03-05',
1300-
'x1': '2009-04-15',
1301-
'type': 'rect',
1302-
'line': {'width': 0}}],
1303-
'showlegend': False,
1304-
'title': 'Gantt Chart',
1305-
'width': 900,
1306-
'xaxis': {'rangeselector': {'buttons': [
1307-
{'count': 7, 'label': '1w',
1308-
'step': 'day', 'stepmode': 'backward'},
1309-
{'count': 1, 'label': '1m',
1310-
'step': 'month', 'stepmode': 'backward'},
1311-
{'count': 6, 'label': '6m',
1312-
'step': 'month', 'stepmode': 'backward'},
1313-
{'count': 1, 'label': 'YTD',
1314-
'step': 'year', 'stepmode': 'todate'},
1315-
{'count': 1, 'label': '1y',
1316-
'step': 'year', 'stepmode': 'backward'},
1317-
{'step': 'all'}
1318-
]},
1319-
'showgrid': False,
1320-
'type': 'date',
1321-
'zeroline': False},
1322-
'yaxis': {'autorange': False,
1323-
'range': [-1, 3],
1324-
'showgrid': False,
1325-
'ticktext': ['Job A', 'Job B'],
1326-
'tickvals': [0, 1],
1327-
'zeroline': False}}
1328-
}
1276+
exp_gantt_chart = {'data': [{'marker': {'color': 'white'},
1277+
'name': '',
1278+
'type': 'scatter',
1279+
'x': ['2009-01-01', '2009-02-30'],
1280+
'y': [0, 0]},
1281+
{'marker': {'color': 'white'},
1282+
'name': '',
1283+
'type': 'scatter',
1284+
'x': ['2009-03-05', '2009-04-15'],
1285+
'y': [1, 1]}],
1286+
'layout': {'height': 600,
1287+
'hovermode': 'closest',
1288+
'shapes': [{'fillcolor': 'rgb(31, 119, 180)',
1289+
'line': {'width': 0},
1290+
'opacity': 1,
1291+
'type': 'rect',
1292+
'x0': '2009-01-01',
1293+
'x1': '2009-02-30',
1294+
'xref': 'x',
1295+
'y0': -0.2,
1296+
'y1': 0.2,
1297+
'yref': 'y'},
1298+
{'fillcolor': 'rgb(255, 127, 14)',
1299+
'line': {'width': 0},
1300+
'opacity': 1,
1301+
'type': 'rect',
1302+
'x0': '2009-03-05',
1303+
'x1': '2009-04-15',
1304+
'xref': 'x',
1305+
'y0': 0.8,
1306+
'y1': 1.2,
1307+
'yref': 'y'}],
1308+
'showlegend': False,
1309+
'title': 'Gantt Chart',
1310+
'width': 900,
1311+
'xaxis': {'rangeselector': {'buttons': [{'count': 7,
1312+
'label': '1w',
1313+
'step': 'day',
1314+
'stepmode': 'backward'},
1315+
{'count': 1,
1316+
'label': '1m',
1317+
'step': 'month',
1318+
'stepmode': 'backward'},
1319+
{'count': 6,
1320+
'label': '6m',
1321+
'step': 'month',
1322+
'stepmode': 'backward'},
1323+
{'count': 1,
1324+
'label': 'YTD',
1325+
'step': 'year',
1326+
'stepmode': 'todate'},
1327+
{'count': 1,
1328+
'label': '1y',
1329+
'step': 'year',
1330+
'stepmode': 'backward'},
1331+
{'step': 'all'}]},
1332+
'showgrid': False,
1333+
'type': 'date',
1334+
'zeroline': False},
1335+
'yaxis': {'autorange': False,
1336+
'range': [-1, 3],
1337+
'showgrid': False,
1338+
'ticktext': ['Job A', 'Job B'],
1339+
'tickvals': [0, 1],
1340+
'zeroline': False}}}
13291341

13301342
self.assertEqual(test_gantt_chart['data'][0],
13311343
exp_gantt_chart['data'][0])

0 commit comments

Comments
 (0)