forked from home-assistant/core
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will show the user a funny rating based on their measured download speed and ping. Co-authored-by: AntonRidderby <AntonRidderby@users.noreply.github.com>
- Loading branch information
1 parent
554ab94
commit 1753462
Showing
6 changed files
with
77 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,9 @@ | |
}, | ||
"upload": { | ||
"name": "Upload" | ||
}, | ||
"funny_rating": { | ||
"name": "Funny rating" | ||
} | ||
} | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
"""Tests for SpeedTest coordinator.""" | ||
|
||
import pytest | ||
|
||
from homeassistant.components.speedtestdotnet import SpeedTestDataCoordinator | ||
|
||
|
||
@pytest.mark.parametrize( | ||
("download", "ping", "expected_result"), | ||
[ | ||
(0.5, 10, "Literal potato speeds."), | ||
(5, 10, "Kinda trashy."), | ||
(25, 10, "Granny dial-up internet."), | ||
(75, 10, "Nothing special, really"), | ||
(150, 10, "Just above average. Bet you feel special."), | ||
(100, 250, "Every online shooter's worst nightmare."), | ||
], | ||
) | ||
def test_generate_funny_rating(download, ping, expected_result) -> None: | ||
"""Test the generate_funny_rating function.""" | ||
assert ( | ||
SpeedTestDataCoordinator.generate_funny_rating(None, download, ping) | ||
== expected_result | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters