summaryrefslogtreecommitdiff
path: root/tests/functional/d/duplicate_dict_literal_key.py
blob: 82e98d23ec59659c87f79af4e75e5bd15a72b804 (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
"""Check multiple key definition"""
# pylint: disable=pointless-statement, redundant-u-string-prefix

from enum import Enum


class MyEnum(Enum):
    """ Sample Enum for testing duplicate keys"""
    KEY = "key"



correct_dict = {
    'tea': 'for two',
    'two': 'for tea',
}

wrong_with_enum = {  # [duplicate-key]
    MyEnum.KEY: "value 1",
    MyEnum.KEY: "value 2",
}

wrong_dict = {  # [duplicate-key]
    'tea': 'for two',
    'two': 'for tea',
    'tea': 'time',

}

{1: b'a', 1: u'a'} # [duplicate-key]
{1: 1, 1.0: 2} # [duplicate-key]