-
Notifications
You must be signed in to change notification settings - Fork 520
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add a basic test file for yaml.load and yaml.dump
- Loading branch information
1 parent
7bd92df
commit 2f87ac4
Showing
3 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import yaml | ||
|
||
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 | ||
|
||
if __name__ == '__main__': | ||
import sys, test_load | ||
sys.modules['test_load'] = sys.modules['__main__'] | ||
import test_appliance | ||
test_appliance.run(globals()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
|
||
from test_dump_load import * | ||
from test_mark import * | ||
from test_reader import * | ||
from test_canonical import * | ||
|