| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
import pytest |
| 6 |
from scalene.scalene_statistics import ScaleneStatistics |
| 7 |
|
| 8 |
|
| 9 |
@pytest.fixture |
| 10 |
def scalene_statistics(): |
| 11 |
stats = ScaleneStatistics() |
| 12 |
stats.memory_stats.current_footprint = 100 |
| 13 |
stats.memory_stats.max_footprint = 200 |
| 14 |
stats.memory_stats.max_footprint_loc = ("some_file.py", 10) |
| 15 |
stats.memory_stats.per_line_footprint_samples[("some_file.py", 10)] = 10 |
| 16 |
yield stats |
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
def test_clear_all(scalene_statistics): |
| 21 |
scalene_statistics.clear_all() |
| 22 |
assert scalene_statistics.memory_stats.current_footprint == 0 |
| 23 |
assert scalene_statistics.memory_stats.max_footprint == 0 |
| 24 |
assert scalene_statistics.memory_stats.max_footprint_loc is None |
| 25 |
assert len(scalene_statistics.memory_stats.per_line_footprint_samples) == 0 |