Skip to content

Commit ed95f20

Browse files
Implemented unit tests for options.series.mappoint.
1 parent 2d4f7bf commit ed95f20

File tree

3 files changed

+219
-0
lines changed

3 files changed

+219
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
data: [
3+
{
4+
lat: 54.321,
5+
lon: 12.345,
6+
x: 5,
7+
y: 10,
8+
dataLabels: {
9+
align: 'center',
10+
allowOverlap: true,
11+
animation: {
12+
defer: 5
13+
},
14+
backgroundColor: {
15+
linearGradient: {
16+
x1: 0.123,
17+
x2: 0.234,
18+
y1: 0.345,
19+
y2: 0.456
20+
},
21+
stops: [
22+
[0.12, '#999'],
23+
[0.34, '#fff']
24+
]
25+
},
26+
borderColor: '#999999',
27+
borderRadius: 24,
28+
borderWidth: 1,
29+
className: 'some-class-name',
30+
color: '#000000',
31+
crop: true,
32+
defer: false,
33+
enabled: true,
34+
filter: {
35+
operator: '>=',
36+
property: 'some_property',
37+
value: 123
38+
},
39+
format: 'some format',
40+
formatter: function() { return true; },
41+
inside: true,
42+
nullFormat: 'some format',
43+
nullFormatter: function() { return true; },
44+
overflow: 'none',
45+
padding: 12,
46+
position: 'center',
47+
rotation: 0,
48+
shadow: false,
49+
shape: 'rect',
50+
style: 'style goes here',
51+
useHTML: false,
52+
verticalAlign: 'top',
53+
x: 10,
54+
y: 20,
55+
z: 0
56+
},
57+
drilldown: 'some-id-goes-here',
58+
geometry: {
59+
"geometry": {
60+
"coordinates": [
61+
-3.68,
62+
40.4
63+
],
64+
"type": "Point"
65+
},
66+
"properties": {},
67+
"type": "Feature"
68+
}
69+
}
70+
],
71+
72+
negativeColor: '#000',
73+
animationLimit: 250,
74+
75+
dataAsColumns: false,
76+
77+
allAreas: true,
78+
joinBy: 'hc-key'
79+
}
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
{
2+
data: [
3+
'invalid value',
4+
{
5+
lat: 54.321,
6+
lon: 12.345,
7+
x: 5,
8+
y: 10,
9+
dataLabels: {
10+
align: 'center',
11+
allowOverlap: true,
12+
animation: {
13+
defer: 5
14+
},
15+
backgroundColor: {
16+
linearGradient: {
17+
x1: 0.123,
18+
x2: 0.234,
19+
y1: 0.345,
20+
y2: 0.456
21+
},
22+
stops: [
23+
[0.12, '#999'],
24+
[0.34, '#fff']
25+
]
26+
},
27+
borderColor: '#999999',
28+
borderRadius: 24,
29+
borderWidth: 1,
30+
className: 'some-class-name',
31+
color: '#000000',
32+
crop: true,
33+
defer: false,
34+
enabled: true,
35+
filter: {
36+
operator: '>=',
37+
property: 'some_property',
38+
value: 123
39+
},
40+
format: 'some format',
41+
formatter: function() { return true; },
42+
inside: true,
43+
nullFormat: 'some format',
44+
nullFormatter: function() { return true; },
45+
overflow: 'none',
46+
padding: 12,
47+
position: 'center',
48+
rotation: 0,
49+
shadow: false,
50+
shape: 'rect',
51+
style: 'style goes here',
52+
useHTML: false,
53+
verticalAlign: 'top',
54+
x: 10,
55+
y: 20,
56+
z: 0
57+
},
58+
drilldown: 'some-id-goes-here',
59+
geometry: {
60+
"geometry": {
61+
"coordinates": [
62+
-3.68,
63+
40.4
64+
],
65+
"type": "Point"
66+
},
67+
"properties": {},
68+
"type": "Feature"
69+
}
70+
}
71+
],
72+
73+
animationLimit: 'invalid value',
74+
dataAsColumns: false,
75+
negativeColor: '#000',
76+
77+
allAreas: true,
78+
joinBy: 'hc-key'
79+
}
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
"""Tests for ``highcharts.no_data``."""
2+
3+
import pytest
4+
5+
from json.decoder import JSONDecodeError
6+
7+
from highcharts_maps.options.series.mappoint import MapPointSeries as cls
8+
from highcharts_maps import errors
9+
from tests.fixtures import input_files, check_input_file, to_camelCase, to_js_dict, \
10+
Class__init__, Class__to_untrimmed_dict, Class_from_dict, Class_to_dict, \
11+
Class_from_js_literal
12+
13+
STANDARD_PARAMS = [
14+
({}, None),
15+
]
16+
17+
18+
@pytest.mark.parametrize('kwargs, error', STANDARD_PARAMS)
19+
def test_MapPointSeries__init__(kwargs, error):
20+
Class__init__(cls, kwargs, error)
21+
22+
23+
@pytest.mark.parametrize('kwargs, error', STANDARD_PARAMS)
24+
def test_MapPointSeries__to_untrimmed_dict(kwargs, error):
25+
Class__to_untrimmed_dict(cls, kwargs, error)
26+
27+
28+
@pytest.mark.parametrize('kwargs, error', STANDARD_PARAMS)
29+
def test_MapPointSeries_from_dict(kwargs, error):
30+
Class_from_dict(cls, kwargs, error)
31+
32+
33+
@pytest.mark.parametrize('kwargs, error', STANDARD_PARAMS)
34+
def test_MapPointSeries_to_dict(kwargs, error):
35+
Class_to_dict(cls, kwargs, error)
36+
37+
38+
@pytest.mark.parametrize('filename, as_file, error', [
39+
('series/mappoint/01.js', False, None),
40+
41+
('series/mappoint/error-01.js',
42+
False,
43+
(errors.HighchartsValueError,
44+
errors.HighchartsParseError,
45+
JSONDecodeError,
46+
TypeError,
47+
ValueError)),
48+
49+
('series/mappoint/01.js', True, None),
50+
51+
('series/mappoint/error-01.js',
52+
True,
53+
(errors.HighchartsValueError,
54+
errors.HighchartsParseError,
55+
JSONDecodeError,
56+
TypeError,
57+
ValueError)),
58+
59+
])
60+
def test_MapPointSeries_from_js_literal(input_files, filename, as_file, error):
61+
Class_from_js_literal(cls, input_files, filename, as_file, error)

0 commit comments

Comments
 (0)