tests.test_list_shortcut   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 12
dl 0
loc 22
rs 10
c 0
b 0
f 0
wmc 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A test_list_mapping_using_shortened_syntax() 0 5 1
1
# pylint: disable=redefined-outer-name,expression-not-assigned,attribute-defined-outside-init,no-member
2
3
from expecter import expect
0 ignored issues
show
introduced by
Unable to import 'expecter'
Loading history...
4
5
import yorm
6
from yorm.types import List, Float
7
8
from . import strip
9
10
11
@yorm.attr(things=List.of_type(Float))
12
@yorm.sync("tmp/example.yml")
13
class Example:
14
    """An example class mapping a list using the shortened syntax."""
15
16
17
def test_list_mapping_using_shortened_syntax():
18
    obj = Example()
19
    obj.things = [1, 2.0, "3"]
20
21
    expect(obj.__mapper__.text) == strip("""
22
    things:
23
    - 1.0
24
    - 2.0
25
    - 3.0
26
    """)
27