Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Question] Get value of key of type Enum as string? #46

Closed
fkromer opened this issue Nov 5, 2018 · 7 comments
Closed

[Question] Get value of key of type Enum as string? #46

fkromer opened this issue Nov 5, 2018 · 7 comments

Comments

@fkromer
Copy link

fkromer commented Nov 5, 2018

Getting the value of a key of type Enum as string feels not intuitive for me. Am I doing it correctly?

from strictyaml import Map, Enum, load, YAML

yaml_snippet = """
a: A
"""
schema = Map({"a": Enum(["A", "B", "C"])})
parsed = load(yaml_snippet, schema)
# parsed is YAML(OrderedDict([('a', YAML(A))]))
# parsed['a'].value is YAML(A)
# parsed['a'].value.value is 'A'
# parsed['a'].data.data is 'A'
@crdoconnor
Copy link
Owner

Are you sure you're using version 0.15.2? That looks like the regression bug I was trying to fix.

@crdoconnor
Copy link
Owner

Nope, I've verified it.

@crdoconnor
Copy link
Owner

OK I'm looking at this now. Really sorry for this, thanks for picking it up.

@fkromer
Copy link
Author

fkromer commented Nov 5, 2018

Oups. Sry I'm with strictyaml==0.15.0. I missed to rebuild the venv 😅

@crdoconnor
Copy link
Owner

Ok fixed in 0.15.3, released just a second ago.

@crdoconnor
Copy link
Owner

Thanks for that. Sorry, that was an embarrassing bug.

I think I'm going to have to do a bit more exploratory testing to see if there's anything else lurking under the surface. I had a few regressions from the Optional thing.

@fkromer
Copy link
Author

fkromer commented Nov 5, 2018

Thx a lot. It's working just fine now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants