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

iplweb / bpp / f77eb09d-4388-431e-b9f3-4fc7a8822640

28 Aug 2025 08:13PM UTC coverage: 39.949% (-3.5%) from 43.402%
f77eb09d-4388-431e-b9f3-4fc7a8822640

push

circleci

mpasternak
Whatever

16244 of 40662 relevant lines covered (39.95%)

0.74 hits per line

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

16.67
src/pbn_api/tests/test_utils.py
1
from pbn_api.utils import rename_dict_key
1✔
2

3

4
def test_rename_dict_key_simple():
1✔
5
    d = {"mniswId": 123}
×
6
    res = rename_dict_key(d, "mniswId", "ministryId")
×
7

8
    assert "mniswId" in d
×
9
    assert "ministryId" not in d
×
10

11
    assert "ministryId" in res
×
12
    assert "mniswId" not in res
×
13

14

15
def test_rename_dict_key_nested():
1✔
16
    d = {"test": {"mniswId": 123}}
×
17
    res = rename_dict_key(d, "mniswId", "ministryId")
×
18

19
    assert "mniswId" in d["test"]
×
20
    assert "ministryId" not in d["test"]
×
21

22
    assert "ministryId" in res["test"]
×
23
    assert "mniswId" not in res["test"]
×
24

25

26
def test_rename_dict_key_nested_in_list():
1✔
27
    d = [{"test": [{"mniswId": 123}]}]
×
28
    res = rename_dict_key(d, "mniswId", "ministryId")
×
29

30
    assert "mniswId" in d[0]["test"][0]
×
31
    assert "ministryId" not in d[0]["test"][0]
×
32

33
    assert "ministryId" in res[0]["test"][0]
×
34
    assert "mniswId" not in res[0]["test"][0]
×
35

36

37
def test_rename_dict_key_real():
1✔
38
    d = {
×
39
        "editors": [{"givenNames": "Ma\u0142gorzata Anna", "lastName": "Test"}],
40
        "isbn": "9788367881944",
41
        "mainLanguage": "pol",
42
        "publicUri": "https://test",
43
        "publicationPlace": "Lublin",
44
        "publisher": {
45
            "mniswId": 85900,
46
            "name": "Wydawnictwo Naukowe TYGIEL Sp. z o. o.",
47
            "objectId": "21234",
48
        },
49
        "title": "Test",
50
        "translation": False,
51
        "type": "EDITED_BOOK",
52
        "year": 2025,
53
    }
54

55
    res = rename_dict_key(d, "mniswId", "ministryId")
×
56

57
    assert "mniswId" in d["publisher"]
×
58
    assert "ministryId" not in d["publisher"]
×
59

60
    assert "ministryId" in res["publisher"]
×
61
    assert "mniswId" not in res["publisher"]
×
62

63

64
def test_rename_dict_key_real_list():
1✔
65
    d = [
×
66
        {
67
            "editors": [{"givenNames": "Ma\u0142gorzata Anna", "lastName": "Test"}],
68
            "isbn": "Test",
69
            "mainLanguage": "pol",
70
            "publicUri": "Test",
71
            "publicationPlace": "Lublin",
72
            "publisher": [
73
                {
74
                    "mniswId": 85900,
75
                    "name": "Wydawnictwo Naukowe TYGIEL Sp. z o. o.",
76
                    "objectId": "Test",
77
                }
78
            ],
79
            "title": "Test",
80
            "translation": False,
81
            "type": "EDITED_BOOK",
82
            "year": 2025,
83
        }
84
    ]
85

86
    res = rename_dict_key(d, "mniswId", "ministryId")
×
87

88
    assert "mniswId" in d[0]["publisher"][0]
×
89
    assert "ministryId" not in d[0]["publisher"][0]
×
90

91
    assert "ministryId" in res[0]["publisher"][0]
×
92
    assert "mniswId" not in res[0]["publisher"][0]
×
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