Commit graph

16 commits

Author SHA1 Message Date
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
Renamed from tests/test_util_dt.py (Browse further)