• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

iplweb / bpp / #819

18 Oct 2025 12:03PM UTC coverage: 59.791% (+25.6%) from 34.185%
#819

push

local-test

MichaƂ Pasternak
autostash

3781 of 9280 branches covered (40.74%)

Branch coverage included in aggregate %.

24978 of 38819 relevant lines covered (64.34%)

0.64 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.37
src/pbn_api/utils.py
1
def rename_dict_key(data, old_key, new_key):
1✔
2
    """
3
    Recursively rename a dictionary key in a dictionary and all nested dictionaries.
4

5
    Args:
6
        data: Dictionary or any data structure that may contain dictionaries
7
        old_key: The key to be renamed
8
        new_key: The new key name
9

10
    Returns:
11
        The modified data structure with renamed keys
12
    """
13
    if isinstance(data, dict):
1✔
14
        # Create a new dictionary with renamed keys
15
        new_dict = {}
1✔
16
        for key, value in data.items():
1✔
17
            # Rename the key if it matches
18
            new_key_name = new_key if key == old_key else key
1✔
19
            # Recursively process the value
20
            new_dict[new_key_name] = rename_dict_key(value, old_key, new_key)
1✔
21
        return new_dict
1✔
22
    elif isinstance(data, list):
1✔
23
        # Process each item in the list
24
        return [rename_dict_key(item, old_key, new_key) for item in data]
1✔
25
    else:
26
        # Return the value unchanged if it's not a dict or list
27
        return data
1✔
28

29

30
def compare_dicts(d1, d2, path=""):
1✔
31
    diffs = []
1✔
32
    keys = set(d1.keys()) | set(d2.keys())
1✔
33

34
    for key in keys:
1✔
35
        key_path = f"{path}.{key}" if path else key
1✔
36

37
        if key not in d1:
1!
38
            diffs.append(f"Key '{key_path}' missing in first dict")
×
39
        elif key not in d2:
1!
40
            diffs.append(f"Key '{key_path}' missing in second dict")
×
41
        else:
42
            v1, v2 = d1[key], d2[key]
1✔
43
            if isinstance(v1, dict) and isinstance(v2, dict):
1✔
44
                diffs.extend(compare_dicts(v1, v2, key_path))
1✔
45
            elif v1 != v2:
1!
46
                diffs.append(f"Value mismatch at '{key_path}': {v1!r} != {v2!r}")
×
47

48
    return diffs
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc