Debian Codegraph @

tests/test_coverup_107.py

raw symbols SCIP
1 # file scalene/scalene_profiler.py:1828-1831
2 # lines [1828, 1829, 1831]
3 # branches []
4
5 import pytest
6 from scalene.scalene_profiler import Scalene
7
8
9 @pytest.fixture(scope="function")
10 def scalene_cleanup(monkeypatch):
11 # Fixture to reset the state after the test
12 # Store the original state
13 original_state = getattr(Scalene, "_Scalene__initialized", False)
14 yield
15 # Restore the original state
16 monkeypatch.setattr(Scalene, "_Scalene__initialized", original_state)
17
18
19 def test_set_initialized(scalene_cleanup, monkeypatch):
20 # Set Scalene as not initialized
21 monkeypatch.setattr(Scalene, "_Scalene__initialized", False)
22 # Call the method to set Scalene as initialized
23 Scalene.set_initialized()
24 # Check if Scalene is now initialized
25 assert getattr(Scalene, "_Scalene__initialized") == True