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

Skip to content

Commit 441a0e6

Browse files
committed
updated tests
1 parent a5d806a commit 441a0e6

File tree

1 file changed

+99
-110
lines changed

1 file changed

+99
-110
lines changed

packages/python/plotly/plotly/tests/test_optional/test_tools/test_figure_factory.py

Lines changed: 99 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1514,18 +1514,32 @@ def test_gannt_groups_and_descriptions(self):
15141514
group_tasks=True
15151515
)
15161516

1517-
exp_gantt_chart = {'data': [{'x': ['2008-10-05',
1518-
'2009-04-15',
1519-
'2008-12-06',
1520-
'2009-03-15',
1521-
'2008-09-07',
1522-
'2009-03-15',
1523-
'2009-05-08',
1524-
'2009-04-15',
1525-
'2009-04-20',
1526-
'2009-05-30'],
1527-
'y': [2, 2, 1, 1, 0, 0, 0, 0, 2, 2],
1528-
'mode': 'markers',
1517+
exp_gantt_chart = {'layout': {'showlegend': True,
1518+
'yaxis': {'range': [-1, 4],
1519+
'zeroline': False,
1520+
'ticktext': ['Task C', 'Task B', 'Task A'],
1521+
'tickvals': [0, 1, 2],
1522+
'autorange': False,
1523+
'showgrid': False},
1524+
'title': 'Gantt Chart',
1525+
'height': 600,
1526+
'shapes': [],
1527+
'width': 900,
1528+
'xaxis': {'zeroline': False,
1529+
'rangeselector': {'buttons': [{'count': 7,
1530+
'step': 'day',
1531+
'stepmode': 'backward',
1532+
'label': '1w'},
1533+
{'count': 1, 'step': 'month', 'stepmode': 'backward', 'label': '1m'},
1534+
{'count': 6, 'step': 'month', 'stepmode': 'backward', 'label': '6m'},
1535+
{'count': 1, 'step': 'year', 'stepmode': 'todate', 'label': 'YTD'},
1536+
{'count': 1, 'step': 'year', 'stepmode': 'backward', 'label': '1y'},
1537+
{'step': 'all'}]},
1538+
'type': 'date',
1539+
'showgrid': False},
1540+
'hovermode': 'closest'},
1541+
'data': [{'showlegend': False,
1542+
'name': '',
15291543
'text': ['Task A - 1',
15301544
'Task A - 1',
15311545
'Task B - 1',
@@ -1547,9 +1561,31 @@ def test_gannt_groups_and_descriptions(self):
15471561
'rgb(220, 0, 0)',
15481562
'rgb(220, 0, 0)'],
15491563
'size': 1},
1550-
'name': '',
1551-
'showlegend': False},
1552-
{'x': ['2008-10-05',
1564+
'mode': 'markers',
1565+
'y': [2, 2, 1, 1, 0, 0, 0, 0, 2, 2],
1566+
'x': ['2008-10-05',
1567+
'2009-04-15',
1568+
'2008-12-06',
1569+
'2009-03-15',
1570+
'2008-09-07',
1571+
'2009-03-15',
1572+
'2009-05-08',
1573+
'2009-04-15',
1574+
'2009-04-20',
1575+
'2009-05-30']},
1576+
{'name': 'TB',
1577+
'fillcolor': 'rgb(170, 14, 200)',
1578+
'mode': 'none',
1579+
'hoverinfo': 'name',
1580+
'y': [0.8, 0.8, 1.2, 1.2],
1581+
'x': ['2008-12-06', '2009-03-15', '2009-03-15', '2008-12-06'],
1582+
'fill': 'toself'},
1583+
{'name': 'TA',
1584+
'fillcolor': 'rgb(220, 0, 0)',
1585+
'mode': 'none',
1586+
'hoverinfo': 'name',
1587+
'y': [1.8, 1.8, 2.2, 2.2, None, 1.8, 1.8, 2.2, 2.2],
1588+
'x': ['2008-10-05',
15531589
'2009-04-15',
15541590
'2009-04-15',
15551591
'2008-10-05',
@@ -1558,20 +1594,13 @@ def test_gannt_groups_and_descriptions(self):
15581594
'2009-05-30',
15591595
'2009-05-30',
15601596
'2009-04-20'],
1561-
'y': [1.8, 1.8, 2.2, 2.2, None, 1.8, 1.8, 2.2, 2.2],
1562-
'mode': 'none',
1563-
'fill': 'toself',
1564-
'hoverinfo': 'name',
1565-
'fillcolor': 'rgb(220, 0, 0)',
1566-
'name': 'TA'},
1567-
{'x': ['2008-12-06', '2009-03-15', '2009-03-15', '2008-12-06'],
1568-
'y': [0.8, 0.8, 1.2, 1.2],
1597+
'fill': 'toself'},
1598+
{'name': 'TC',
1599+
'fillcolor': 'rgb(255, 230, 41)',
15691600
'mode': 'none',
1570-
'fill': 'toself',
15711601
'hoverinfo': 'name',
1572-
'fillcolor': 'rgb(170, 14, 200)',
1573-
'name': 'TB'},
1574-
{'x': ['2008-09-07',
1602+
'y': [-0.2, -0.2, 0.2, 0.2, None, -0.2, -0.2, 0.2, 0.2],
1603+
'x': ['2008-09-07',
15751604
'2009-03-15',
15761605
'2009-03-15',
15771606
'2008-09-07',
@@ -1580,52 +1609,12 @@ def test_gannt_groups_and_descriptions(self):
15801609
'2009-04-15',
15811610
'2009-04-15',
15821611
'2009-05-08'],
1583-
'y': [-0.2, -0.2, 0.2, 0.2, None, -0.2, -0.2, 0.2, 0.2],
1584-
'mode': 'none',
1585-
'fill': 'toself',
1586-
'hoverinfo': 'name',
1587-
'fillcolor': 'rgb(255, 230, 41)',
1588-
'name': 'TC'}],
1589-
'layout': {'title': 'Gantt Chart',
1590-
'showlegend': True,
1591-
'height': 600,
1592-
'width': 900,
1593-
'shapes': [],
1594-
'hovermode': 'closest',
1595-
'yaxis': {'showgrid': False,
1596-
'ticktext': ['Task C', 'Task B', 'Task A'],
1597-
'tickvals': [0, 1, 2],
1598-
'range': [-1, 4],
1599-
'autorange': False,
1600-
'zeroline': False},
1601-
'xaxis': {'showgrid': False,
1602-
'zeroline': False,
1603-
'rangeselector': {'buttons': [{'count': 7,
1604-
'label': '1w',
1605-
'step': 'day',
1606-
'stepmode': 'backward'},
1607-
{'count': 1, 'label': '1m', 'step': 'month', 'stepmode': 'backward'},
1608-
{'count': 6, 'label': '6m', 'step': 'month', 'stepmode': 'backward'},
1609-
{'count': 1, 'label': 'YTD', 'step': 'year', 'stepmode': 'todate'},
1610-
{'count': 1, 'label': '1y', 'step': 'year', 'stepmode': 'backward'},
1611-
{'step': 'all'}]},
1612-
'type': 'date'}}
1613-
}
1612+
'fill': 'toself'}]}
16141613

1615-
self.assertEqual(test_gantt_chart['data'][0],
1616-
exp_gantt_chart['data'][0])
16171614

1618-
self.assertEqual(test_gantt_chart['data'][1],
1619-
exp_gantt_chart['data'][1])
16201615

1621-
self.assertEqual(test_gantt_chart['data'][2],
1622-
exp_gantt_chart['data'][2])
1623-
1624-
self.assertEqual(test_gantt_chart['data'][3],
1625-
exp_gantt_chart['data'][3])
1626-
1627-
self.assertEqual(test_gantt_chart['layout'],
1628-
exp_gantt_chart['layout'])
1616+
self.assertDictEqual(test_gantt_chart['data'][0],
1617+
exp_gantt_chart['data'][0])
16291618

16301619
def test_gantt_all_args(self):
16311620

@@ -1646,57 +1635,57 @@ def test_gantt_all_args(self):
16461635
height=500, width=500
16471636
)
16481637

1649-
exp_gantt_chart = {'data': [{'x': ['2010-01-01', '2011-02-02', '2011-01-01', '2012-06-05'],
1650-
'y': [0, 0, 1, 1],
1651-
'mode': 'markers',
1638+
exp_gantt_chart = {'layout': {'showlegend': False,
1639+
'yaxis': {'range': [-1, 3],
1640+
'zeroline': False,
1641+
'ticktext': ['Run', 'Fast'],
1642+
'tickvals': [0, 1],
1643+
'autorange': False,
1644+
'showgrid': True},
1645+
'title': 'Title',
1646+
'height': 500,
1647+
'shapes': [],
1648+
'width': 500,
1649+
'xaxis': {'zeroline': False,
1650+
'rangeselector': {'buttons': [{'count': 7,
1651+
'step': 'day',
1652+
'stepmode': 'backward',
1653+
'label': '1w'},
1654+
{'count': 1, 'step': 'month', 'stepmode': 'backward', 'label': '1m'},
1655+
{'count': 6, 'step': 'month', 'stepmode': 'backward', 'label': '6m'},
1656+
{'count': 1, 'step': 'year', 'stepmode': 'todate', 'label': 'YTD'},
1657+
{'count': 1, 'step': 'year', 'stepmode': 'backward', 'label': '1y'},
1658+
{'step': 'all'}]},
1659+
'type': 'date',
1660+
'showgrid': True},
1661+
'hovermode': 'closest'},
1662+
'data': [{'showlegend': False,
1663+
'name': '',
16521664
'text': [None, None, None, None],
16531665
'marker': {'color': ['rgb(220.0, 220.0, 220.0)',
16541666
'rgb(220.0, 220.0, 220.0)',
16551667
'rgb(166.25, 167.5, 208.0)',
16561668
'rgb(166.25, 167.5, 208.0)'],
16571669
'size': 1},
1658-
'name': '',
1659-
'showlegend': False},
1660-
{'x': ['2010-01-01', '2011-02-02', '2011-02-02', '2010-01-01'],
1661-
'y': [-0.5, -0.5, 0.5, 0.5],
1670+
'mode': 'markers',
1671+
'y': [0, 0, 1, 1],
1672+
'x': ['2010-01-01', '2011-02-02', '2011-01-01', '2012-06-05']},
1673+
{'showlegend': False,
1674+
'name': '25',
1675+
'fillcolor': 'rgb(166.25, 167.5, 208.0)',
16621676
'mode': 'none',
1663-
'fill': 'toself',
1664-
'showlegend': False,
16651677
'hoverinfo': 'name',
1666-
'fillcolor': 'rgb(220.0, 220.0, 220.0)',
1667-
'name': '0'},
1668-
{'x': ['2011-01-01', '2012-06-05', '2012-06-05', '2011-01-01'],
16691678
'y': [0.5, 0.5, 1.5, 1.5],
1679+
'x': ['2011-01-01', '2012-06-05', '2012-06-05', '2011-01-01'],
1680+
'fill': 'toself'},
1681+
{'showlegend': False,
1682+
'name': '0',
1683+
'fillcolor': 'rgb(220.0, 220.0, 220.0)',
16701684
'mode': 'none',
1671-
'fill': 'toself',
1672-
'showlegend': False,
16731685
'hoverinfo': 'name',
1674-
'fillcolor': 'rgb(166.25, 167.5, 208.0)',
1675-
'name': '25'}],
1676-
'layout': {'title': 'Title',
1677-
'showlegend': False,
1678-
'height': 500,
1679-
'width': 500,
1680-
'shapes': [],
1681-
'hovermode': 'closest',
1682-
'yaxis': {'showgrid': True,
1683-
'ticktext': ['Run', 'Fast'],
1684-
'tickvals': [0, 1],
1685-
'range': [-1, 3],
1686-
'autorange': False,
1687-
'zeroline': False},
1688-
'xaxis': {'showgrid': True,
1689-
'zeroline': False,
1690-
'rangeselector': {'buttons': [{'count': 7,
1691-
'label': '1w',
1692-
'step': 'day',
1693-
'stepmode': 'backward'},
1694-
{'count': 1, 'label': '1m', 'step': 'month', 'stepmode': 'backward'},
1695-
{'count': 6, 'label': '6m', 'step': 'month', 'stepmode': 'backward'},
1696-
{'count': 1, 'label': 'YTD', 'step': 'year', 'stepmode': 'todate'},
1697-
{'count': 1, 'label': '1y', 'step': 'year', 'stepmode': 'backward'},
1698-
{'step': 'all'}]},
1699-
'type': 'date'}}}
1686+
'y': [-0.5, -0.5, 0.5, 0.5],
1687+
'x': ['2010-01-01', '2011-02-02', '2011-02-02', '2010-01-01'],
1688+
'fill': 'toself'}]}
17001689

17011690
self.assertEqual(test_gantt_chart['data'][0],
17021691
exp_gantt_chart['data'][0])

0 commit comments

Comments
 (0)