File: test_coverup_68.py

package info (click to toggle)
scalene 1.5.51-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 15,528 kB
  • sloc: cpp: 22,930; python: 13,403; javascript: 11,769; ansic: 817; makefile: 196; sh: 45
file content (36 lines) | stat: -rw-r--r-- 1,005 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# file scalene/scalene_statistics.py:365-374
# lines [371, 372, 373, 374]
# branches ['371->exit', '371->372', '372->371', '372->373']

import pytest
from scalene.scalene_statistics import ScaleneStatistics
from typing import Dict

@pytest.fixture
def cleanup():
    # Fixture to clean up any changes after the test
    yield
    # No specific cleanup code needed as the test does not modify any global state

def test_increment_per_line_samples(cleanup):
    # Define the source and destination dictionaries
    src = {
        "file1.py": {1: 10, 2: 20},
        "file2.py": {1: 5}
    }
    dest = {
        "file1.py": {1: 1, 2: 2},
        "file2.py": {1: 0}
    }
    
    # Expected result after incrementing
    expected_dest = {
        "file1.py": {1: 11, 2: 22},
        "file2.py": {1: 5}
    }
    
    # Call the method to test
    ScaleneStatistics.increment_per_line_samples(dest, src)
    
    # Assert that the destination has been correctly incremented
    assert dest == expected_dest