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

Allow to safe_dump with OrderedDict instances #5

Merged
merged 3 commits into from
Apr 17, 2018
Merged

Conversation

wimglenn
Copy link
Owner

resolves #4

@coveralls
Copy link

coveralls commented Apr 17, 2018

Pull Request Test Coverage Report for Build 18

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 13: 0.0%
Covered Lines: 16
Relevant Lines: 16

💛 - Coveralls

@wimglenn wimglenn merged commit ab8da29 into master Apr 17, 2018
@wimglenn wimglenn deleted the safe_dump branch April 17, 2018 17:25
@@ -18,6 +18,7 @@ def map_constructor(loader, node):

pyyaml.add_representer(dict, map_representer)
pyyaml.add_representer(OrderedDict, map_representer)
pyyaml.add_representer(OrderedDict, map_representer, Dumper=pyyaml.dumper.SafeDumper)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Interesting, why are both of the above lines needed?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pyyaml.add_representer works on the Dumper class obj passed into it.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, but if I remove line 20 everything still works for me. Do you have a test that fails when that line is removed?

Copy link
Owner Author

@wimglenn wimglenn Apr 18, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Really? That's odd. For me, the existing test_dump and test_dump_all fail without line 20. Could you send me your pip freeze.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, "works for me" is not "running the oyaml tests" :-) All good, if you have tests that prove it's needed, that's weird, but okay :-)

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK. I've released v0.3 to warehouse (the new PyPI).

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

git tags are a thing you know ;-)

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

Successfully merging this pull request may close these issues.

can't safely dump OrderedDict
3 participants