* fixed race condition and added test case for updates before db load
* removed duplicated code
* improved comments, removed superfluous errors / assertions
* allow both possible outcomes of race condition
* use approx for float comparison
* Update tests/components/statistics/test_sensor.py
Co-authored-by: Erik Montnemery <erik@montnemery.com>
* force new state before database load in race condition test
---------
Co-authored-by: Erik Montnemery <erik@montnemery.com>