Skip to content

Commit

Permalink
Add a test to assert load(s) fails
Browse files Browse the repository at this point in the history
  • Loading branch information
ingydotnet committed Sep 23, 2021
1 parent af0275b commit 1b2f534
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/lib/test_dump_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,15 @@ def test_dump(verbose=False):
assert yaml.dump(['foo'])
test_dump.unittest = True

def test_load_no_loader(verbose=False):
try:
yaml.load("- foo\n")
except TypeError:
return True
assert(False, "load() require Loader=...")

test_load_no_loader.unittest = True

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

0 comments on commit 1b2f534

Please sign in to comment.