Skip to content

Commit d6512ce

Browse files
committed
Fixed bugs in SinglePointData for validation and .from_array().
1 parent 969da40 commit d6512ce

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

highcharts_core/options/series/data/single_point.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import Optional
22
from decimal import Decimal
3+
from collections import UserDict
34

45
from validator_collection import validators, checkers
56

@@ -70,7 +71,10 @@ def drilldown(self) -> Optional[str]:
7071

7172
@drilldown.setter
7273
def drilldown(self, value):
73-
self._drilldown = validators.string(value, allow_empty = True)
74+
if isinstance(value, constants.EnforcedNullType):
75+
self._drilldown = value
76+
else:
77+
self._drilldown = validators.string(value, allow_empty = True)
7478

7579
@classmethod
7680
def _get_kwargs_from_dict(cls, as_dict):
@@ -178,6 +182,12 @@ def from_array(cls, value):
178182
as_obj = cls(y = None)
179183
elif checkers.is_numeric(item):
180184
as_obj = cls(y = item)
185+
elif checkers.is_iterable(item, forbid_literals = (str, bytes, dict, UserDict)):
186+
if len(item) == 2:
187+
as_obj = cls(name = item[0],
188+
y = item[1])
189+
elif len(item) == 1:
190+
as_obj = cls(y = item[0])
181191
else:
182192
raise errors.HighchartsValueError(f'each data point supplied must either '
183193
f'be a Single Point Data Point or be '

0 commit comments

Comments
 (0)