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

test_emitter.test_emitter_styles failing when using C extensions on python2 only #206

Open
dthkao opened this issue Jul 17, 2018 · 2 comments

Comments

@dthkao
Copy link
Contributor

dthkao commented Jul 17, 2018

I might be misunderstanding what is expected behavior, but at the very least there seems to be some inconsistency in test results described below.

When running test_emitter with python 2 using cython extension, the error I see is

AssertionError: (ScalarEvent(anchor=None, tag=u'tag:yaml.org,2002:str', implicit=(False, False), value=u'foo'), ScalarEvent(anchor=None, tag=u'tag:yaml.org,2002:str', implicit=(False, False), value=u'foo %YAML 1.1'))

Specifically, when I turn on verbose mode, for the test case (filename='third_party/py/yaml/tests/data/spec-07-09.canonical', flow_style=False, style=''), I see as the emitted output:

OUTPUT (filename='third_party/py/yaml/tests/data/spec-07-09.canonical', flow_style=False, style='')
%YAML 1.1
--- !!str foo
%YAML 1.1
--- !!str bar
%YAML 1.1
--- !!str baz

In comparison, for python 3 (with or without C extensions) and for python 2 without extensions I see this output with verbose on:

OUTPUT (filename='third_party/py/yaml/tests/data/spec-07-09.canonical', flow_style=False, style='')
%YAML 1.1
--- !!str 'foo'
%YAML 1.1
--- !!str 'bar'
%YAML 1.1
--- !!str 'baz'

So this really brings up 2 questions for me:

  1. In the passing test cases, why isn't the emitted style "plain" (no quotes)?
  2. What's different for py2 w/ extensions?
@perlpunk
Copy link
Member

I can't say anything about the different behaviour of python 2 and 3 right now, but the error you see (getting foo %YAML 1.1 instead of just foo) stems from a bug in libyaml which will be fixed with the next release. See yaml/libyaml#122

@dthkao
Copy link
Contributor Author

dthkao commented Jul 18, 2018

Thanks! I am curious why the behavior differs, as well as why the plain-style scalar events are emitted with quotes. Is this a special case of YAML 1.1?

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