blob: 2d675093a843982ea6575d827dd65a8a80e2ed0b (
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
|
# coding: utf-8
import platform
import pytest
@pytest.mark.skipif(
platform.python_implementation() == 'Jython', reason='Jython throws RepresenterError'
)
def test_load_cyaml():
import ruamel.yaml
assert ruamel.yaml.__with_libyaml__
from ruamel.yaml.cyaml import CLoader
ruamel.yaml.load('abc: 1', Loader=CLoader)
def test_dump_cyaml():
import ruamel.yaml
data = {'a': 1, 'b': 2}
res = ruamel.yaml.dump(
data,
Dumper=ruamel.yaml.cyaml.CSafeDumper,
default_flow_style=False,
allow_unicode=True,
)
assert res == 'a: 1\nb: 2\n'
|