Skip to content

Commit 772bfae

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent c8eb0e0 commit 772bfae

File tree

3 files changed

+14
-13
lines changed

3 files changed

+14
-13
lines changed

src/lightning_app/cli/cmd_clusters.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -317,4 +317,3 @@ def echo_cluster_status_long(
317317
message += f" [{duration_seconds(seconds_in_current_state)}]"
318318

319319
click.echo(message)
320-

src/lightning_app/utilities/string_formatting.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
def duration_seconds(seconds: int) -> str:
32
"""Generates a duration string in 00h00m00s format."""
43
mins, seconds = divmod(seconds, 60)
@@ -9,4 +8,4 @@ def duration_seconds(seconds: int) -> str:
98
duration = f"{mins:02}m" + duration
109
if hours:
1110
duration = f"{hours:02}h" + duration
12-
return duration
11+
return duration

tests/tests_app/utilities/test_string_formatting.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,18 @@
33
from lightning_app.utilities.string_formatting import duration_seconds
44

55

6-
@pytest.mark.parametrize("seconds,want_string", [
7-
(0, "00s"),
8-
(0.1, "0.1s"),
9-
(5, "05s"),
10-
(50, "50s"),
11-
(60, "01m00s"),
12-
(60*60, "01h00s"),
13-
(60*60+60, "01h01m00s"),
14-
(60*60*25, "25h00s"),
15-
])
6+
@pytest.mark.parametrize(
7+
"seconds,want_string",
8+
[
9+
(0, "00s"),
10+
(0.1, "0.1s"),
11+
(5, "05s"),
12+
(50, "50s"),
13+
(60, "01m00s"),
14+
(60 * 60, "01h00s"),
15+
(60 * 60 + 60, "01h01m00s"),
16+
(60 * 60 * 25, "25h00s"),
17+
],
18+
)
1619
def test_duration_seconds(seconds, want_string):
1720
assert want_string == duration_seconds(seconds)

0 commit comments

Comments
 (0)