Spaces:
Running
Running
Download tests/test_runtime_sorting.py from OpenHands/openhands-index: direct link, hf CLI and curl.
- Browser
- Download file 1.09 kB
-
https://huggingface.co/spaces/OpenHands/openhands-index/resolve/refs%2Fpr%2F30/tests/test_runtime_sorting.py
- Command line
-
hf download hf://spaces/OpenHands/openhands-index@refs/pr/30/tests/test_runtime_sorting.py
-
curl -L -o test_runtime_sorting.py https://huggingface.co/spaces/OpenHands/openhands-index/resolve/refs%2Fpr%2F30/tests/test_runtime_sorting.py
1.09 kB
| import pandas as pd | |
| from leaderboard_transformer import format_runtime_column | |
| def test_runtime_strings_sort_numerically_in_ascending_order(): | |
| df = pd.DataFrame( | |
| { | |
| "Average Score": [0.8, 0.8, 0.8, 0.8, None], | |
| "Average Runtime": [1323.0, 372.0, 410.0, None, None], | |
| } | |
| ) | |
| formatted = format_runtime_column(df.copy(), "Average Runtime") | |
| runtimes = formatted["Average Runtime"].tolist() | |
| assert sorted(runtimes) == [ | |
| runtimes[1], | |
| runtimes[2], | |
| runtimes[0], | |
| runtimes[3], | |
| runtimes[4], | |
| ] | |
| def test_runtime_formatting_preserves_visible_labels(): | |
| df = pd.DataFrame( | |
| { | |
| "Average Score": [0.8, 0.8, None], | |
| "Average Runtime": [45.2, None, None], | |
| } | |
| ) | |
| formatted = format_runtime_column(df.copy(), "Average Runtime") | |
| values = formatted["Average Runtime"].tolist() | |
| assert values[0].endswith("45s") | |
| assert values[1].endswith("Missing</span>") | |
| assert values[2].endswith("Not Submitted</span>") | |
| assert 'display:none' in values[0] | |