| 1 | # file scalene/scalene_profiler.py:313-316 |
| 2 | # lines [316] |
| 3 | # branches [] |
| 4 | |
| 5 | import pytest |
| 6 | import scalene.scalene_config |
| 7 | from scalene.scalene_profiler import Scalene |
| 8 | |
| 9 | |
| 10 | @pytest.fixture(scope="function") |
| 11 | def reset_scalene_config(): |
| 12 | # Store original value to restore after test |
| 13 | original_trigger_length = scalene.scalene_config.NEWLINE_TRIGGER_LENGTH |
| 14 | yield |
| 15 | # Restore original value |
| 16 | scalene.scalene_config.NEWLINE_TRIGGER_LENGTH = original_trigger_length |
| 17 | |
| 18 | |
| 19 | def test_update_line_executes_line_316(reset_scalene_config): |
| 20 | # Set the trigger length to a non-zero value to ensure the bytearray is created |
| 21 | scalene.scalene_config.NEWLINE_TRIGGER_LENGTH = 1 |
| 22 | # Call the method that should execute line 316 |
| 23 | Scalene.update_line() |
| 24 | # No specific postconditions to assert; the test is for coverage of line 316 |