summaryrefslogtreecommitdiff
path: root/tests/functional/u/use/use_literal_dict.py
blob: 598b382bdfa9486034f2ceb566cd536657378488 (plain)
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
37
38
39
40
41
42
43
44
45
46
# pylint: disable=missing-docstring, invalid-name, disallowed-name, unused-argument, too-few-public-methods

x = dict()  # [use-dict-literal]
x = dict(a="1", b=None, c=3)  # [use-dict-literal]
x = dict(zip(["a", "b", "c"], [1, 2, 3]))
x = {}
x = {"a": 1, "b": 2, "c": 3}
x = dict(**x)  # [use-dict-literal]

def bar(boo: bool = False):
    return 1

x = dict(foo=bar())  # [use-dict-literal]

baz = {"e": 9, "f": 1}

dict(  # [use-dict-literal]
    **baz,
    suggestions=list(
        bar(
            boo=True,
        )
    ),
)

class SomeClass:
    prop: dict = {"a": 1}

inst = SomeClass()

dict(  # [use-dict-literal]
    url="/foo",
    **inst.prop,
)

dict(  # [use-dict-literal]
    Lorem="ipsum",
    dolor="sit",
    amet="consectetur",
    adipiscing="elit",
    sed="do",
    eiusmod="tempor",
    incididunt="ut",
    labore="et",
    dolore="magna",
)