Ticket #27 (closed defect: worksforme)

Opened 8 years ago

Last modified 2 days ago

yaml.dump seems to be broken

Reported by: anonymous Owned by: xi
Priority: normal Component: pyyaml
Severity: normal Keywords:


I may be missing something here, but this seems to be broken:

Example that works:

>>> print yaml.dump({'name': "The Cloak 'Colluin'", 'depth': 5, 'rarity': 45, 'weight': 10, 'cost': 50000, 'flags': ['INT', 'WIS', 'SPEED', 'STEALTH']})
cost: 50000
depth: 5
name: The Cloak 'Colluin'
rarity: 45
weight: 10

Portion of above example:

>>> print yaml.dump({'name': "The Cloak 'Colluin'", 'depth': 5})
{depth: 5, name: The Cloak 'Colluin'}

I would expect to get:

depth: 5
name: The Cloak 'Colluin'


Change History

comment:1 Changed 8 years ago by xi

  • Status changed from new to closed
  • Resolution set to worksforme

Duplicate of #18.

It's a correct output despite the fact that the style of the nested mapping is different.

If you want collections to be always serialized in a block style, try

>>> print yaml.dump({'name': "The Cloak 'Colluin'", 'depth': 5}, default_flow_style=False)
{depth: 5, name: The Cloak 'Colluin'}

comment:2 Changed 2 days ago by simas <kerdos@…>

 Cipto Junaedy is a customer research expert. "There are plenty of safe, effective HCA nutritional supplement out there. Finding one with  Unit Link Terbaik di Indonesia Commonwealth Life Investra Link 60% HCA with no food additives is vital."


Add a comment

Modify Ticket

Change Properties
<Author field>
as closed
The resolution will be deleted. Next status will be 'reopened'

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.