Skip to content

Commit

Permalink
Add a basic test file for yaml.load and yaml.dump
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Sep 23, 2021
1 parent 360b3da commit 1c1c55a
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tests/lib/test_appliance.py
@@ -1,5 +1,6 @@

import sys, os, os.path, types, traceback, pprint
import warnings

DATA = 'tests/data'

Expand Down Expand Up @@ -123,7 +124,7 @@ def run(collections, args=None):
for function in test_functions:
if include_functions and function.__name__ not in include_functions:
continue
if function.unittest:
if function.unittest and function.unittest is not True:
for base, exts in test_filenames:
if include_filenames and base not in include_filenames:
continue
Expand Down
19 changes: 19 additions & 0 deletions tests/lib/test_dump_load.py
@@ -0,0 +1,19 @@
import yaml

def test_dump(verbose=False):
assert yaml.dump(['foo'])
test_dump.unittest = True

def test_load(verbose=False):
assert yaml.load("- foo\n")
test_load.unittest = True

def test_load_safeloader(verbose=False):
assert yaml.load("- foo\n", Loader=yaml.SafeLoader)
test_load_safeloader.unittest = True

if __name__ == '__main__':
import sys, test_load
sys.modules['test_load'] = sys.modules['__main__']
import test_appliance
test_appliance.run(globals())
1 change: 1 addition & 0 deletions tests/lib/test_yaml.py
@@ -1,4 +1,5 @@

from test_dump_load import *
from test_mark import *
from test_reader import *
from test_canonical import *
Expand Down

0 comments on commit 1c1c55a

Please sign in to comment.