Commit Graph

27 Commits (f10b36873a440cc10adddca8cd60e0d7aa7899eb)

Author SHA1 Message Date
Kevin Stillhammer 90e5d69184
Add template as_timedelta () 2022-05-23 19:32:22 +02:00
J. Nick Koston 4e9bc9eaff
Small cleanups to find_next_time_expression and addition of tests () 2022-05-14 12:13:32 -07:00
J. Nick Koston ebce5660e3
Sync event timed_fired and the context ulid time () 2022-05-14 12:12:08 -07:00
Tobias Sauerwein 8b38fa58aa
Bump pytest to 7.0.0 () 2022-02-08 10:03:27 +01:00
Otto Winter a9c0f89c09
Fix find_next_time_expression_time ()
* Better tests

* Fix find_next_time_expression_time

* Add tests for Nov 7th 2021, Chicago transtion

* Update event tests

* Update test_event.py

* small performance improvement

Co-authored-by: J. Nick Koston <nick@koston.org>
Co-authored-by: Erik Montnemery <erik@montnemery.com>
2021-11-01 17:45:13 +01:00
J. Nick Koston bf2d40adfe
Migrate from pytz to python-dateutil ()
Co-authored-by: Paulus Schoutsen <balloob@gmail.com>
2021-05-07 22:46:26 -07:00
Franck Nijhof 5a2b5fe7c5
Yoda assertion style removed is () 2021-03-20 13:55:10 +01:00
Franck Nijhof 8a56dbf587
Add flake8 comprehensions checks to pre-commit & CI () 2021-03-19 13:41:09 +01:00
Dmitry b106149588
Fix string parameter processing in parse_time_expression () () 2020-10-09 11:48:49 +02:00
J. Nick Koston f8704a2dfc
Ensure we always fire time pattern changes after microsecond 0 () 2020-08-28 16:27:25 +02:00
Jelle Raaijmakers ef254a1c3d
Round time values in get_age() to better approximate the actual age () 2020-07-09 11:19:38 -07:00
Paulus Schoutsen 4de97abc3a Black 2019-07-31 12:25:30 -07:00
Anders Melchiorsen a439e087e1 Fix time expression parsing () 2019-06-22 13:39:33 +02:00
Erik Montnemery 407e0c58f9 Migrate tests to pytest ()
* Migrate tests to pytest

* Fixup

* Use loop fixture in test_check_config

* Lint
2019-04-30 09:20:38 -07:00
Paulus Schoutsen 08fe7c3ece
Pytest tests ()
* Convert core tests

* Convert component tests to use pytest assert

* Lint 🤷‍♂️

* Fix test

* Fix 3 typos in docs
2018-10-24 12:10:05 +02:00
Otto Winter 26cf5acd5b Make async_track_time_change smarter ()
* Make async_track_time_change smarter

* Move to util/dt

* Remove unnecessary check

* Lint

* Remove tzinfo check

* Remove check

* Add comment about async_track_point_in_utc_time

* Fix typing check

* Lint
2018-10-09 10:14:18 +02:00
Ville Skyttä dbd0763f83 Grammar and spelling fixes () 2018-08-19 22:29:08 +02:00
Paulus Schoutsen 6899c7b6f7 assertEquals is deprecated () 2017-05-25 22:21:22 -07:00
Fabian Affolter be272ac64a Disable too-many-* ()
* Disable too-many-* and too-few-public-methods

* Remove globally disabled pylint warnings
2016-10-30 22:18:53 +01:00
Fabian Heredia Montiel d4f78e8552 Type Hints - Core/Utils/Helpers Part 1 ()
* Fix deprecated(moved) import

* Add util/dt typing

* Green on mypy util/dt

* Fix some errors

* First part of yping util/yaml

* Add more typing to util/yaml
2016-07-23 11:07:08 -07:00
Daniel Høyer Iversen 630b7377bd Refactor get_age in util/dt () 2016-05-14 12:05:46 -07:00
Robbie Trencheny b75aa6ac08 Add get_age tests 2016-05-11 22:29:55 -07:00
Charles Spirakis b86a1ece01 Allow conversion from date strings to "unix" timestamp. ()
"unix" timestamp is number of seconds since Jan 1, 1970 UTC.
This allows scripts that use templates to generate time
deltas in seconds if desired from state attributes such
as last_updated.

Some examples:

timestamp now is
{{ as_timestamp(now) }}

timstamp of last change is
{{ as_timestamp(states.binary_sensor.garage_door.last_changed) }}

seconds since last change is
{{ as_timestamp(now) - as_timestamp(states.binary_sensor.garage_door.last_changed) }}
2016-05-06 18:33:46 -07:00
Paulus Schoutsen 68d92c3196 Use standardised datetime format 2016-04-16 01:46:50 -07:00
Fabian Affolter 9838697d2b Fix PEP257 issues 2016-03-09 10:25:50 +01:00
Fabian Affolter 00afaac54c Update for file header, docstrings, and PEP8/PEP257 2016-02-13 14:19:11 +01:00
Paulus Schoutsen 0c56fde5a9 Reorg tests folder 2015-07-26 10:17:01 +02:00