a83177aac6
Fixes https://gitlab.com/buildroot.org/buildroot/-/jobs/2088684091 python sample_python_pyyaml_dec.py Traceback (most recent call last): File "/root/sample_python_pyyaml_dec.py", line 5, in <module> data = yaml.load(serialized) TypeError: load() missing 1 required positional argument: 'Loader' yaml.load() requires a loader argument since the move to version 6.0: https://github.com/yaml/pyyaml/pull/561 The test does not need the extra functionality of load(), so instead move to the recommended safe_load(). Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Tested-by: Romain Naour <romain.naour@gmail.com> Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
11 lines
286 B
Python
11 lines
286 B
Python
import yaml
|
|
|
|
with open("/tmp/data.yml", "rb") as f:
|
|
serialized = f.read()
|
|
data = yaml.safe_load(serialized)
|
|
print(data)
|
|
assert(data["name"] == "python-pyyaml")
|
|
assert(data["versions"] == ["1", "2"])
|
|
assert(data["group"]["is_a_package"] is True)
|
|
assert(data["group"]["value"] == 42)
|