Debian Codegraph @

tests/test_coverup_80.py

raw symbols SCIP
1 # file scalene/scalene_profiler.py:318-325
2 # lines [318, 319, 320, 321, 322, 323, 325]
3 # branches []
4
5 import pytest
6 from scalene.scalene_profiler import Scalene
7 from threading import Lock
8
9 # Mocking the necessary parts of Scalene to ensure the test can run
10 Scalene._Scalene__invalidate_mutex = Lock()
11 Scalene._Scalene__invalidate_queue = []
12 Scalene.last_profiled_tuple = lambda: ("filename.py", 123)
13 Scalene.update_line = staticmethod(lambda: None)
14
15
16 def test_update_profiled():
17 # Ensure the queue is empty before the test
18 Scalene._Scalene__invalidate_queue.clear()
19
20 # Call the method we want to test
21 Scalene.update_profiled()
22
23 # Check postconditions
24 assert len(Scalene._Scalene__invalidate_queue) == 1
25 assert Scalene._Scalene__invalidate_queue[0] == ("filename.py", 123)
26
27 # Clean up after the test
28 Scalene._Scalene__invalidate_queue.clear()
29
30
31 # Run the test
32 def test_scalene_update_profiled():
33 test_update_profiled()