| 1 | # file scalene/scalene_profiler.py:290-293 |
| 2 | # lines [290, 291, 293] |
| 3 | # branches [] |
| 4 | |
| 5 | import pytest |
| 6 | from scalene.scalene_profiler import Scalene |
| 7 | |
| 8 | |
| 9 | @pytest.fixture(scope="function") |
| 10 | def scalene_cleanup(): |
| 11 | # Fixture to reset the state after the test |
| 12 | original_in_jupyter = Scalene._Scalene__in_jupyter |
| 13 | yield |
| 14 | Scalene._Scalene__in_jupyter = original_in_jupyter |
| 15 | |
| 16 | |
| 17 | def test_set_in_jupyter(scalene_cleanup): |
| 18 | # Ensure that __in_jupyter is initially False |
| 19 | assert not Scalene._Scalene__in_jupyter |
| 20 | # Call the method to set __in_jupyter to True |
| 21 | Scalene.set_in_jupyter() |
| 22 | # Check if __in_jupyter is now True |
| 23 | assert Scalene._Scalene__in_jupyter |