| 1 | # file scalene/scalene_json.py:33-48 |
| 2 | # lines [44, 46] |
| 3 | # branches ['43->44', '45->46'] |
| 4 | |
| 5 | import pytest |
| 6 | from scalene.scalene_json import ScaleneJSON |
| 7 | |
| 8 | |
| 9 | @pytest.fixture |
| 10 | def cleanup(): |
| 11 | # Setup code if necessary |
| 12 | yield |
| 13 | # Teardown code if necessary |
| 14 | |
| 15 | |
| 16 | def test_time_consumed_str_minutes_seconds(cleanup): |
| 17 | # Test for minutes and seconds (line 44) |
| 18 | time_str = ScaleneJSON.time_consumed_str(65000) # 1 minute and 5 seconds |
| 19 | assert time_str == "1m:5.000s" |
| 20 | |
| 21 | |
| 22 | def test_time_consumed_str_seconds(cleanup): |
| 23 | # Test for only seconds (line 46) |
| 24 | time_str = ScaleneJSON.time_consumed_str(5000) # 5 seconds |
| 25 | assert time_str == "5.000s" |