simplify test
This commit is contained in:
parent
923116a113
commit
f4112a758a
@ -18,20 +18,8 @@ def parse_yaml(stream, override={}):
|
|||||||
|
|
||||||
|
|
||||||
def test_parse_yaml():
|
def test_parse_yaml():
|
||||||
import tempfile
|
|
||||||
import os
|
|
||||||
|
|
||||||
text = """foo: bar
|
text = """foo: bar
|
||||||
this: that
|
this: that
|
||||||
var: '%(foo)'"""
|
var: '%(foo)'"""
|
||||||
|
|
||||||
# we save this text to a temporary file
|
assert parse_yaml(text) == {'foo': 'bar', 'this': 'that', 'var': 'bar'}
|
||||||
file_name = tempfile.mkstemp()[1]
|
|
||||||
with open(file_name, 'w') as f:
|
|
||||||
f.write(text)
|
|
||||||
|
|
||||||
with open(file_name, 'r') as f:
|
|
||||||
assert parse_yaml(f) == {'foo': 'bar', 'this': 'that', 'var': 'bar'}
|
|
||||||
|
|
||||||
# we remove the temporary file
|
|
||||||
os.unlink(file_name)
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user