Commit 82c3d5a
plugin.TimeSliderChoropleth numeric timestamp sort (#1502)
For description of problem see:
[plugins.TimeSliderChoropleth() time slider bar out of order for date range that spans '2001-09-09' #1502](#1502)
Files changed:
folium/plugins/time_slider_choropleth.py:
- try numeric sort first
- if not numeric e.g. date strings, and exception thrown, then fall back to generic sort.
- Problem if string as alphabetic sort ('2' > '10') may result in out of order
tests/plugins/test_time_slider_choropleth.py:
- No longer expected fail
- Avoid hardwiring in timestamp values
- Avoid the convenient call to datetime.strftime('%s') for timestamps as Windows only returns string date
- Carefully chosen date range to span 2001-09-09
Ran tests and qa:
- flake8 --max-line-length=120 tests/plugins/test_time_slider_choropleth.py folium/plugins/time_slider_choropleth.py
- python -m pytest tests/plugins/test_time_slider_choropleth.py (previous commit fixed xfail)1 parent 51f1b7c commit 82c3d5a
2 files changed
Lines changed: 23 additions & 10 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
150 | 150 | | |
151 | 151 | | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
154 | 158 | | |
155 | 159 | | |
156 | 160 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
| |||
29 | 28 | | |
30 | 29 | | |
31 | 30 | | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | | - | |
| 38 | + | |
| 39 | + | |
34 | 40 | | |
35 | 41 | | |
36 | 42 | | |
| |||
71 | 77 | | |
72 | 78 | | |
73 | 79 | | |
74 | | - | |
| 80 | + | |
75 | 81 | | |
76 | 82 | | |
77 | 83 | | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
0 commit comments