diff options
author | Thom Smith <thom@thomthesmith.com> | 2021-09-22 11:51:14 -0400 |
---|---|---|
committer | Ingy döt Net <ingy@ingy.net> | 2021-09-23 14:42:00 -0700 |
commit | 961ce9dcf53dcef41f6268bbbb7c6a685a46c899 (patch) | |
tree | a735c5eb1824fdb2235374cdfa7eb385658f3776 | |
parent | 141afddd45d29594e5e1699e54a8d817b10c660d (diff) | |
download | pyyaml-git-961ce9dcf53dcef41f6268bbbb7c6a685a46c899.tar.gz |
Fix issue with representing Enum types
-rw-r--r-- | lib/yaml/representer.py | 2 | ||||
-rw-r--r-- | tests/data/construct-python-name-module.code | 2 | ||||
-rw-r--r-- | tests/data/construct-python-name-module.data | 1 | ||||
-rw-r--r-- | tests/lib/test_constructor.py | 3 |
4 files changed, 6 insertions, 2 deletions
diff --git a/lib/yaml/representer.py b/lib/yaml/representer.py index 3b0b192..808ca06 100644 --- a/lib/yaml/representer.py +++ b/lib/yaml/representer.py @@ -369,7 +369,7 @@ Representer.add_representer(complex, Representer.add_representer(tuple, Representer.represent_tuple) -Representer.add_representer(type, +Representer.add_multi_representer(type, Representer.represent_name) Representer.add_representer(collections.OrderedDict, diff --git a/tests/data/construct-python-name-module.code b/tests/data/construct-python-name-module.code index 6f39148..b8a4b6f 100644 --- a/tests/data/construct-python-name-module.code +++ b/tests/data/construct-python-name-module.code @@ -1 +1 @@ -[str, yaml.Loader, yaml.dump, abs, yaml.tokens] +[str, yaml.Loader, yaml.dump, abs, yaml.tokens, signal.Handlers] diff --git a/tests/data/construct-python-name-module.data b/tests/data/construct-python-name-module.data index f0c9712..f1a2c24 100644 --- a/tests/data/construct-python-name-module.data +++ b/tests/data/construct-python-name-module.data @@ -3,3 +3,4 @@ - !!python/name:yaml.dump - !!python/name:abs - !!python/module:yaml.tokens +- !!python/name:signal.Handlers diff --git a/tests/lib/test_constructor.py b/tests/lib/test_constructor.py index f9a5077..28987d2 100644 --- a/tests/lib/test_constructor.py +++ b/tests/lib/test_constructor.py @@ -5,6 +5,9 @@ import pprint import datetime import yaml.tokens +# Import any packages here that need to be referenced in .code files. +import signal + def execute(code): global value exec(code) |