-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
guibog
committed
Feb 29, 2024
1 parent
05d641b
commit b8c5005
Showing
7 changed files
with
154 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
|
||
import pytest | ||
import io | ||
import ruyaml # NOQA | ||
from .roundtrip import round_trip, dedent | ||
|
||
from ruyaml import YAML | ||
from ruyaml.util import load_yaml_guess_indent | ||
from ruyaml.scalarbool import ScalarBoolean | ||
from ruyaml.comments import CommentedSeq | ||
from ruyaml.representer import RoundTripRepresenter, ScalarNode | ||
from ruyaml.constructor import RoundTripConstructor | ||
from typing import Text, Any, Dict, List # NOQA | ||
|
||
|
||
def round_trip_stabler( | ||
inp, | ||
outp=None, | ||
): | ||
if outp is None: | ||
outp = inp | ||
doutp = dedent(outp) | ||
yaml = ruyaml.YAML() | ||
yaml.preserve_quotes = True | ||
yaml.preserve_block_seqs_indents = True | ||
data = yaml.load(doutp) | ||
buf = io.StringIO() | ||
yaml.dump(data, stream=buf) | ||
res = buf.getvalue() | ||
assert res == doutp | ||
|
||
|
||
class TestStability: | ||
|
||
def test_blockseq1(self): | ||
round_trip( | ||
""" | ||
a: | ||
- a1 | ||
- a2 | ||
""" | ||
) | ||
|
||
@pytest.mark.xfail(strict=True) | ||
def test_blockseq2(self): | ||
round_trip( | ||
""" | ||
a: | ||
- a1 | ||
- a2 | ||
""" | ||
) | ||
|
||
@pytest.mark.xfail(strict=True) | ||
def test_blockseq3(self): | ||
round_trip( | ||
""" | ||
a: | ||
- a1 | ||
- a2 | ||
b: | ||
- b1 | ||
- b2 | ||
""" | ||
) | ||
|
||
class TestStabilityStabler: | ||
|
||
def test_blockseq1(self): | ||
round_trip_stabler( | ||
""" | ||
a: | ||
- a1 | ||
- a2 | ||
""" | ||
) | ||
|
||
def test_blockseq2(self): | ||
round_trip_stabler( | ||
""" | ||
a: | ||
- a1 | ||
- a2 | ||
""" | ||
) | ||
|
||
def test_blockseq3(self): | ||
round_trip_stabler( | ||
""" | ||
a: | ||
- a1 | ||
- a2 | ||
b: | ||
- b1 | ||
- b2 | ||
""" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters