1616import numpy as np
1717
1818
19+ def _normalize (rendered ):
20+ return '' .join (rendered .split ())
21+
22+
1923def test_heat_map_with_time ():
2024 np .random .seed (3141592 )
2125 initial_data = (np .random .normal (size = (100 , 2 )) * np .array ([[1 , 1 ]]) +
@@ -41,45 +45,46 @@ def test_heat_map_with_time():
4145
4246 # We verify that the script part is correct.
4347 tmpl = Template ("""
44- var times = {{this.times}};
45-
46- {{this._parent.get_name()}}.timeDimension = L.timeDimension(
47- {times : times, currentTime: new Date(1)}
48- );
49-
50- var {{this._control_name}} = new L.Control.TimeDimensionCustom({{this.index}}, {
51- autoPlay: {{this.auto_play}},
52- backwardButton: {{this.backward_button}},
53- displayDate: {{this.display_index}},
54- forwardButton: {{this.forward_button}},
55- limitMinimumRange: {{this.limit_minimum_range}},
56- limitSliders: {{this.limit_sliders}},
57- loopButton: {{this.loop_button}},
58- maxSpeed: {{this.max_speed}},
59- minSpeed: {{this.min_speed}},
60- playButton: {{this.play_button}},
61- playReverseButton: {{this.play_reverse_button}},
62- position: "{{this.position}}",
63- speedSlider: {{this.speed_slider}},
64- speedStep: {{this.speed_step}},
65- styleNS: "{{this.style_NS}}",
66- timeSlider: {{this.time_slider}},
67- timeSliderDrapUpdate: {{this.time_slider_drap_update}},
68- timeSteps: {{this.index_steps}}
69- })
70- .addTo({{this._parent.get_name()}});
71-
72- var {{this.get_name()}} = new TDHeatmap({{this.data}},
73- {heatmapOptions: {
74- radius: {{this.radius}},
75- minOpacity: {{this.min_opacity}},
76- maxOpacity: {{this.max_opacity}},
77- scaleRadius: {{this.scale_radius}},
78- useLocalExtrema: {{this.use_local_extrema}},
79- defaultWeight: 1 ,
80- }
81- })
82- .addTo({{this._parent.get_name()}});
48+ var times = {{this.times}};
49+
50+ {{this._parent.get_name()}}.timeDimension = L.timeDimension(
51+ {times : times, currentTime: new Date(1)}
52+ );
53+
54+ var {{this._control_name}} = new L.Control.TimeDimensionCustom({{this.index}}, {
55+ autoPlay: {{this.auto_play}},
56+ backwardButton: {{this.backward_button}},
57+ displayDate: {{this.display_index}},
58+ forwardButton: {{this.forward_button}},
59+ limitMinimumRange: {{this.limit_minimum_range}},
60+ limitSliders: {{this.limit_sliders}},
61+ loopButton: {{this.loop_button}},
62+ maxSpeed: {{this.max_speed}},
63+ minSpeed: {{this.min_speed}},
64+ playButton: {{this.play_button}},
65+ playReverseButton: {{this.play_reverse_button}},
66+ position: "{{this.position}}",
67+ speedSlider: {{this.speed_slider}},
68+ speedStep: {{this.speed_step}},
69+ styleNS: "{{this.style_NS}}",
70+ timeSlider: {{this.time_slider}},
71+ timeSliderDrapUpdate: {{this.time_slider_drap_update}},
72+ timeSteps: {{this.index_steps}}
73+ })
74+ .addTo({{this._parent.get_name()}});
75+
76+ var {{this.get_name()}} = new TDHeatmap({{this.data}},
77+ {heatmapOptions: {
78+ radius: {{this.radius}},
79+ minOpacity: {{this.min_opacity}},
80+ maxOpacity: {{this.max_opacity}},
81+ scaleRadius: {{this.scale_radius}},
82+ useLocalExtrema: {{this.use_local_extrema}},
83+ defaultWeight: 1,
84+ {% if this.gradient %}gradient: {{ this.gradient }}{% endif %}
85+ }
86+ })
87+ .addTo({{this._parent.get_name()}});
8388 """ )
8489
85- assert tmpl .render (this = hm )
90+ assert _normalize ( tmpl .render (this = hm )) in _normalize ( out )
0 commit comments