| 1 | # file scalene/scalene_profiler.py:295-298 |
| 2 | # lines [295, 296, 298] |
| 3 | # branches [] |
| 4 | |
| 5 | import pytest |
| 6 | from scalene.scalene_profiler import Scalene |
| 7 | |
| 8 | |
| 9 | # Test function to check if Scalene.in_jupyter() returns the correct value |
| 10 | def test_in_jupyter(monkeypatch): |
| 11 | # Set up the environment to simulate running inside Jupyter |
| 12 | monkeypatch.setattr(Scalene, "_Scalene__in_jupyter", True) |
| 13 | assert Scalene.in_jupyter() is True |
| 14 | |
| 15 | # Clean up by setting the environment to simulate not running inside Jupyter |
| 16 | monkeypatch.setattr(Scalene, "_Scalene__in_jupyter", False) |
| 17 | assert Scalene.in_jupyter() is False |