diff options
author | Ingy döt Net <ingy@ingy.net> | 2021-09-23 06:26:42 -0700 |
---|---|---|
committer | Ingy döt Net <ingy@ingy.net> | 2021-09-23 06:26:42 -0700 |
commit | 1c1c55a9a38f01e5249eaddf012a7c26b21fa12d (patch) | |
tree | 942eb0c7056210147c0f1092c0005b7fbc14176a | |
parent | 360b3da087eadd79df8c5c0562bd76bcdd945157 (diff) | |
download | pyyaml-git-load-default-safe.tar.gz |
Add a basic test file for yaml.load and yaml.dumpload-default-safe
-rw-r--r-- | tests/lib/test_appliance.py | 3 | ||||
-rw-r--r-- | tests/lib/test_dump_load.py | 19 | ||||
-rw-r--r-- | tests/lib/test_yaml.py | 1 |
3 files changed, 22 insertions, 1 deletions
diff --git a/tests/lib/test_appliance.py b/tests/lib/test_appliance.py index b6f956d..5bf9d5a 100644 --- a/tests/lib/test_appliance.py +++ b/tests/lib/test_appliance.py @@ -1,5 +1,6 @@ import sys, os, os.path, types, traceback, pprint +import warnings DATA = 'tests/data' @@ -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 diff --git a/tests/lib/test_dump_load.py b/tests/lib/test_dump_load.py new file mode 100644 index 0000000..1aa1d1c --- /dev/null +++ b/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()) diff --git a/tests/lib/test_yaml.py b/tests/lib/test_yaml.py index 7b3d8f9..a5c10a3 100644 --- a/tests/lib/test_yaml.py +++ b/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 * |