Skip to content

Commit

Permalink
Confirm quotes are preserved
Browse files Browse the repository at this point in the history
  • Loading branch information
jacebrowning committed Jul 30, 2020
1 parent c30e6c7 commit 0fadac0
Showing 1 changed file with 17 additions and 8 deletions.
25 changes: 17 additions & 8 deletions tests/test_saving.py
Original file line number Diff line number Diff line change
Expand Up @@ -449,25 +449,34 @@ def with_comments_on_list_items(expect):
"""
)

def with_quotations(expect):
sample = Sample(None, None, None, "42")
def with_quotes(expect):
@datafile('../tmp/sample.yml', manual=True)
class Sample:
s1: str = ''
s2: str = ''
s3: str = ''

sample = Sample()

write(
'tmp/sample.yml',
"""
str_: "42"
s1: a
s2: 'b'
s3: "c"
""",
)

sample.datafile.load()
sample.float_ = 1
sample.s1 = 'd'
sample.s2 = 'e'
sample.s3 = 'f'
sample.datafile.save()

expect(read('tmp/sample.yml')) == dedent(
"""
str_: "42"
bool_: false
int_: 0
float_: 1.0
s1: d
s2: 'e'
s3: "f"
"""
)

0 comments on commit 0fadac0

Please sign in to comment.