|
1 | 1 | """Unit tests for time trigger functions.""" |
2 | 2 |
|
3 | 3 | from datetime import datetime as dt |
4 | | -import locale |
5 | 4 |
|
6 | 5 | from custom_components.pyscript.function import Function |
7 | 6 | from custom_components.pyscript.trigger import TrigTime |
@@ -70,11 +69,6 @@ async def test_parse_date_time(hass, caplog): |
70 | 69 | hass.config.elevation = 0 |
71 | 70 | hass.config.time_zone = "America/Los_Angeles" |
72 | 71 |
|
73 | | - # |
74 | | - # Set English since the week names use locale |
75 | | - # |
76 | | - locale.setlocale(locale.LC_ALL, "en_US") |
77 | | - |
78 | 72 | Function.init(hass) |
79 | 73 | TrigTime.init(hass) |
80 | 74 |
|
@@ -111,11 +105,6 @@ async def test_parse_date_time_day_names(hass, caplog): |
111 | 105 | hass.config.elevation = 0 |
112 | 106 | hass.config.time_zone = "America/Los_Angeles" |
113 | 107 |
|
114 | | - # |
115 | | - # Set English since the week names use locale |
116 | | - # |
117 | | - locale.setlocale(locale.LC_ALL, "en_US") |
118 | | - |
119 | 108 | Function.init(hass) |
120 | 109 | TrigTime.init(hass) |
121 | 110 |
|
@@ -178,10 +167,7 @@ async def test_parse_date_time_day_names(hass, caplog): |
178 | 167 | ) |
179 | 168 | def test_timer_active_check(hass, spec, now, expected): |
180 | 169 | """Run time active check tests.""" |
181 | | - # |
182 | | - # Set English since the week names use locale |
183 | | - # |
184 | | - locale.setlocale(locale.LC_ALL, "en_US") |
| 170 | + |
185 | 171 | Function.init(hass) |
186 | 172 | TrigTime.init(hass) |
187 | 173 | out = TrigTime.timer_active_check(spec, now) |
@@ -359,11 +345,6 @@ def test_timer_trigger_next(hass): |
359 | 345 | hass.config.longitude = -122 |
360 | 346 | hass.config.elevation = 0 |
361 | 347 | hass.config.time_zone = "America/Los_Angeles" |
362 | | - # |
363 | | - |
364 | | - # Set English since the week names use locale |
365 | | - # |
366 | | - locale.setlocale(locale.LC_ALL, "en_US") |
367 | 348 |
|
368 | 349 | Function.init(hass) |
369 | 350 | TrigTime.init(hass) |
@@ -474,12 +455,10 @@ def test_timer_trigger_next(hass): |
474 | 455 |
|
475 | 456 | def test_timer_trigger_next_month_rollover(hass): |
476 | 457 | """Run month rollover tests.""" |
477 | | - # |
478 | | - # Set English since the week names use locale |
479 | | - # |
480 | | - locale.setlocale(locale.LC_ALL, "en_US") |
| 458 | + |
481 | 459 | Function.init(hass) |
482 | 460 | TrigTime.init(hass) |
| 461 | + |
483 | 462 | for test_data in timerTriggerNextTestsMonthRollover: |
484 | 463 | now = dt(2020, 6, 30, 13, 0, 0, 100000) |
485 | 464 | spec, expect_seq = test_data |
|
0 commit comments