Skip to content

Commit fd3f3e8

Browse files
authored
Merge pull request #46 from highcharts-for-python/develop
PR for v.1.4.3
2 parents 774c3ff + 582a614 commit fd3f3e8

File tree

4 files changed

+48
-3
lines changed

4 files changed

+48
-3
lines changed

CHANGES.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
Release 1.4.3
2+
=========================================
3+
4+
* **BUGFIX**: Fixed error in ``FlagsSeries`` serialization and added unit test.
5+
6+
---------------------
7+
18
Release 1.4.2
29
=========================================
310

highcharts_stock/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '1.4.2'
1+
__version__ = '1.4.3'

highcharts_stock/options/series/flags.py

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,25 @@ def data(self, value):
6565
if not is_ndarray(value) and not value:
6666
self._data = None
6767
else:
68-
self._data = SingleXData.from_array(value)
68+
self._data = self._data_point_class().from_array(value)
69+
70+
@classmethod
71+
def _data_collection_class(cls):
72+
"""Returns the class object used for the data collection.
73+
74+
:rtype: :class:`DataPointCollection <highcharts_core.options.series.data.collections.DataPointCollection>`
75+
descendent
76+
"""
77+
return SingleXDataCollection
78+
79+
@classmethod
80+
def _data_point_class(cls):
81+
"""Returns the class object used for individual data points.
82+
83+
:rtype: :class:`DataBase <highcharts_core.options.series.data.base.DataBase>`
84+
descendent
85+
"""
86+
return SingleXData
6987

7088
@classmethod
7189
def _get_kwargs_from_dict(cls, as_dict):
@@ -192,6 +210,7 @@ def _to_untrimmed_dict(self, in_cls = None) -> dict:
192210
}
193211
untrimmed_parents = mro__to_untrimmed_dict(self, in_cls = in_cls) or {}
194212
for key in untrimmed_parents:
195-
untrimmed[key] = untrimmed_parents[key]
213+
if key not in untrimmed:
214+
untrimmed[key] = untrimmed_parents[key]
196215

197216
return untrimmed

tests/options/series/test_flags.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,22 @@ def test_FlagsSeries_to_dict(kwargs, error):
5757
])
5858
def test_FlagsSeries_from_js_literal(input_files, filename, as_file, error):
5959
Class_from_js_literal(cls, input_files, filename, as_file, error)
60+
61+
62+
def test_FlagsSeries_to_js_literal():
63+
data_points = [{'x': 1635255000000, 'title': 'Sell'},
64+
{'x': 1635427800000, 'title': 'Sell'},
65+
{'x': 1636119000000, 'title': 'Buy'},
66+
{'x': 1636381800000, 'title': 'Buy'},
67+
{'x': 1636468200000, 'title': 'Sell'}]
68+
flag_series = cls(data = data_points,
69+
on_series = 'dataseries',
70+
shape = 'squarepin',
71+
name = 'Flags on series')
72+
assert flag_series is not None
73+
assert isinstance(flag_series, cls) is True
74+
75+
result = flag_series.to_js_literal()
76+
assert result is not None
77+
assert isinstance(result, str) is True
78+
assert 'data:' in result

0 commit comments

Comments
 (0)