Completed
Push — develop ( 86b58f...0a86d2 )
by Jace
03:19
created

tests/test_list_shortcut.py (1 issue)

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
The import expecter could not be resolved.

This can be caused by one of the following:

1. Missing Dependencies

This error could indicate a configuration issue of Pylint. Make sure that your libraries are available by adding the necessary commands.

# .scrutinizer.yml
before_commands:
    - sudo pip install abc # Python2
    - sudo pip3 install abc # Python3
Tip: We are currently not using virtualenv to run pylint, when installing your modules make sure to use the command for the correct version.

2. Missing __init__.py files

This error could also result from missing __init__.py files in your module folders. Make sure that you place one file in each sub-folder.

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