11"""Tests for ``highcharts.no_data``."""
22
33import pytest
4+ from typing import List
45
56from json .decoder import JSONDecodeError
67
@@ -17,13 +18,38 @@ class NonAbstractDataBase(DataBase):
1718 def from_array (cls , value ):
1819 pass
1920
21+ def _get_props_from_array (self ) -> List [str ]:
22+ """Returns a list of the property names that can be set using the
23+ :meth:`.from_array() <highcharts_core.options.series.data.base.DataBase.from_array>`
24+ method.
25+
26+ :rtype: :class:`list <python:list>` of :class:`str <python:str>`
27+ """
28+ return ['fromArrayProp1' , 'fromArrayProp2' ]
29+
30+
31+
2032cls = NonAbstractDataBase
2133
2234
2335class RequiringJSObject (NonAbstractDataBase ):
2436 def _to_untrimmed_dict (self ):
2537 return {'someKey' : 123 }
2638
39+ class NotRequiringJSObject (NonAbstractDataBase ):
40+ def _to_untrimmed_dict (self ):
41+ return {
42+ 'fromArrayProp1' : 456 ,
43+ 'fromArrayProp2' : 789
44+ }
45+
46+
47+ class RequiringJSObject2 (NonAbstractDataBase ):
48+ def _to_untrimmed_dict (self ):
49+ return {'someKey' : 123 ,
50+ 'fromArrayProp1' : 456 ,
51+ 'fromArrayProp2' : 789 }
52+
2753
2854STANDARD_PARAMS = [
2955 ({}, None ),
@@ -102,8 +128,10 @@ def test_from_js_literal(input_files, filename, as_file, error):
102128
103129@pytest .mark .parametrize ('cls, expected' , [
104130 (NonAbstractDataBase , False ),
131+ (NotRequiringJSObject , False ),
105132 (RequiringJSObject , True ),
106-
133+ (RequiringJSObject2 , True )
134+
107135])
108136def test_requires_js_object (cls , expected ):
109137 obj = cls ()
0 commit comments