Code Duplication    Length = 26-29 lines in 2 locations

tests/test_files.py 1 location

@@ 25-53 (lines=29) @@
22
    """Sample list container."""
23
24
25
@yorm.attr(array=IntegerList)
26
@yorm.attr(false=Boolean)
27
@yorm.attr(number_int=Integer)
28
@yorm.attr(number_real=Float)
29
@yorm.attr(object=EmptyDictionary)
30
@yorm.attr(string=String)
31
@yorm.attr(true=Boolean)
32
@yorm.sync("tmp/path/to/{self.category}/{self.name}.yml")
33
class SampleStandardDecorated:
34
    """Sample class using standard attribute types."""
35
36
    def __init__(self, name, category='default'):
37
        # pylint: disable=duplicate-code
38
        self.name = name
39
        self.category = category
40
        # https://docs.python.org/3.4/library/json.html#json.JSONDecoder
41
        self.object = {}
42
        self.array = []
43
        # pylint: disable=duplicate-code
44
        self.string = ""
45
        self.number_int = 0
46
        self.number_real = 0.0
47
        # pylint: disable=duplicate-code
48
        self.true = True
49
        self.false = False
50
        self.null = None
51
52
    def __repr__(self):
53
        return "<decorated {}>".format(id(self))
54
55
56
# TESTS #######################################################################

tests/test_examples.py 1 location

@@ 42-67 (lines=26) @@
39
        return "<standard {}>".format(id(self))
40
41
42
@yorm.attr(array=IntegerList)
43
@yorm.attr(falsey=Boolean)
44
@yorm.attr(number_int=Integer)
45
@yorm.attr(number_real=Float)
46
@yorm.attr(object=EmptyDictionary)
47
@yorm.attr(string=String)
48
@yorm.attr(truthy=Boolean)
49
@yorm.sync("tmp/{self.category}/{self.name}.yml")
50
class SampleStandardDecorated:
51
    """Sample class using standard attribute types."""
52
53
    def __init__(self, name, category='default'):
54
        self.name = name
55
        self.category = category
56
        # https://docs.python.org/3.4/library/json.html#json.JSONDecoder
57
        self.object = {}
58
        self.array = []
59
        self.string = ""
60
        self.number_int = 0
61
        self.number_real = 0.0
62
        self.truthy = True
63
        self.falsey = False
64
        self.null = None
65
66
    def __repr__(self):
67
        return "<decorated {}>".format(id(self))
68
69
70
@yorm.attr(label=String)