Skip to content

Commit fbba0bc

Browse files
authored
Merge pull request #5 from highcharts-for-python/enhancement/add-unit-tests
Added unit tests with 73% coverage.
2 parents 66dae7a + d0e1db5 commit fbba0bc

File tree

1,201 files changed

+480890
-319
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,201 files changed

+480890
-319
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,4 @@ dmypy.json
131131

132132
# temp files
133133
~$*.*
134-
tests/input_files/headless_export/output/
134+
#tests/input_files/headless_export/output/

highcharts_gantt/chart.py

Lines changed: 330 additions & 3 deletions
Large diffs are not rendered by default.

highcharts_gantt/constants.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,16 @@
1515
]
1616

1717
GANTT_INCLUDE_STR = """<script src="https://code.highcharts.com/gantt/modules/gantt.js"></script>"""
18+
19+
20+
MONDAY_TEMPLATES = {
21+
'task-management': {
22+
'id': 'id',
23+
'name': 'name',
24+
'start': 'start',
25+
'end': 'end',
26+
'parent': 'parent_id',
27+
'milestone': 'is_milestone',
28+
'completed': 'completed'
29+
},
30+
}

highcharts_gantt/errors.py

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,13 @@ class MondayAuthenticationError(HighchartsValueError):
1515
pass
1616

1717

18-
class JIRAAuthenticationError(HighchartsValueError):
19-
""":exc:`ValueError <python:ValueError>` encountered when trying to call
20-
:meth:`GanttSeries.from_jira() <highcharts_gantt.options.series.gantt.GanttSeries.from_jira>`
21-
with improperly configured authentication."""
18+
class MondayBoardNotFoundError(HighchartsValueError):
19+
""":exc:`ValueError <python:ValueError>` encountered when an indicated Monday.com board was not found."""
20+
pass
21+
22+
23+
class MondayItemNotFoundError(HighchartsValueError):
24+
""":exc:`ValueError <python:ValueError>` encountered when an indicated Monday.com item (task) was not found."""
2225
pass
2326

2427

@@ -29,7 +32,14 @@ class MondayTemplateError(HighchartsValueError):
2932
pass
3033

3134

32-
class DuplicateJIRAIssueError(HighchartsValueError):
35+
class JIRAAuthenticationError(HighchartsValueError):
36+
""":exc:`ValueError <python:ValueError>` encountered when trying to call
37+
:meth:`GanttSeries.from_jira() <highcharts_gantt.options.series.gantt.GanttSeries.from_jira>`
38+
with improperly configured authentication."""
39+
pass
40+
41+
42+
class JIRADuplicateIssueError(HighchartsValueError):
3343
""":exc:`ValueError <python:ValueError>` encountered when encountering a JIRA issue
3444
that is a duplicate of another issue."""
3545
pass
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from highcharts_stock.global_options.language.stock_tools import *

highcharts_gantt/global_options/shared_options.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
from highcharts_gantt import errors
99
from highcharts_gantt.decorators import validate_types
10-
from highcharts_core.global_options.shared_options import SharedOptions
10+
from highcharts_stock.global_options.shared_options import SharedOptions, SharedStockOptions
1111

1212

1313
class SharedGanttOptions(HighchartsGanttOptions):

highcharts_gantt/headless_export.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
from highcharts_core.headless_export import ExportServer as ExportServerBase
77

88
from highcharts_gantt.decorators import validate_types
9-
from highcharts_gantt.options import HighchartsOptions, HighchartsGanttOptions
9+
from highcharts_gantt.options import HighchartsOptions, HighchartsGanttOptions, HighchartsStockOptions
1010
from highcharts_gantt.global_options.shared_options import (SharedOptions,
11+
SharedStockOptions,
1112
SharedGanttOptions)
1213

1314
load_dotenv()
@@ -33,7 +34,7 @@ def __init__(self, **kwargs):
3334
super().__init__(**kwargs)
3435

3536
@property
36-
def options(self) -> Optional[HighchartsOptions | HighchartsGanttOptions]:
37+
def options(self) -> Optional[HighchartsOptions | HighchartsGanttOptions | HighchartsStockOptions]:
3738
"""The :class:`HighchartsOptions` which should be applied to render the exported
3839
chart. Defaults to :obj:`None <python:None>`.
3940
@@ -45,7 +46,7 @@ def options(self) -> Optional[HighchartsOptions | HighchartsGanttOptions]:
4546
def options(self, value):
4647
if not value:
4748
self._options = None
48-
elif checkers.is_type(value, ('HighchartsGanttOptions', 'HighchartsOptions')):
49+
elif checkers.is_type(value, ('HighchartsGanttOptions', 'HighchartsOptions', 'HighchartsStockOptions')):
4950
self._options = value
5051
elif ('navigator' in value
5152
or 'range_selector' in value
@@ -56,7 +57,7 @@ def options(self, value):
5657
self._options = validate_types(value, HighchartsOptions)
5758

5859
@property
59-
def global_options(self) -> Optional[SharedOptions | SharedGanttOptions]:
60+
def global_options(self) -> Optional[SharedOptions | SharedGanttOptions | SharedStockOptions]:
6061
"""The global options which will be passed to the (JavaScript)
6162
``Highcharts.setOptions()`` method, and which will be applied to the exported
6263
chart. Defaults to :obj:`None <python:None>`.
@@ -73,6 +74,8 @@ def global_options(self, value):
7374
else:
7475
if checkers.is_type(value, 'SharedGanttOptions'):
7576
self._global_options = value
77+
elif checkers.is_type(value, 'SharedStockOptions'):
78+
self._global_options = value
7679
elif checkers.is_type(value, 'SharedOptions'):
7780
self._global_options = value
7881
elif ('navigator' in value

0 commit comments

Comments
 (0)